mirror of
https://github.com/writeas/writefreely
synced 2025-01-21 03:05:36 +01:00
Add debugging flag
This also includes a new Dev config options
This commit is contained in:
parent
59ea5da521
commit
a3b7b260c5
9
app.go
9
app.go
@ -24,6 +24,10 @@ const (
|
||||
softwareVer = "0.1"
|
||||
)
|
||||
|
||||
var (
|
||||
debugging bool
|
||||
)
|
||||
|
||||
type app struct {
|
||||
router *mux.Router
|
||||
db *datastore
|
||||
@ -35,10 +39,13 @@ type app struct {
|
||||
var shttp = http.NewServeMux()
|
||||
|
||||
func Serve() {
|
||||
debugPtr := flag.Bool("debug", false, "Enables debug logging.")
|
||||
createConfig := flag.Bool("create-config", false, "Creates a basic configuration and exits")
|
||||
doConfig := flag.Bool("config", false, "Run the configuration process")
|
||||
flag.Parse()
|
||||
|
||||
debugging = *debugPtr
|
||||
|
||||
if *createConfig {
|
||||
log.Info("Creating configuration...")
|
||||
c := config.New()
|
||||
@ -70,6 +77,8 @@ func Serve() {
|
||||
cfg: cfg,
|
||||
}
|
||||
|
||||
app.cfg.Server.Dev = *debugPtr
|
||||
|
||||
// Load keys
|
||||
log.Info("Loading encryption keys...")
|
||||
err = initKeys(app)
|
||||
|
@ -11,6 +11,8 @@ const (
|
||||
type (
|
||||
ServerCfg struct {
|
||||
Port int `ini:"port"`
|
||||
|
||||
Dev bool `ini:"-"`
|
||||
}
|
||||
|
||||
DatabaseCfg struct {
|
||||
|
Loading…
Reference in New Issue
Block a user