|
|
@ -24,6 +24,10 @@ const ( |
|
|
|
softwareVer = "0.1" |
|
|
|
softwareVer = "0.1" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
|
|
|
|
debugging bool |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
type app struct { |
|
|
|
type app struct { |
|
|
|
router *mux.Router |
|
|
|
router *mux.Router |
|
|
|
db *datastore |
|
|
|
db *datastore |
|
|
@ -35,10 +39,13 @@ type app struct { |
|
|
|
var shttp = http.NewServeMux() |
|
|
|
var shttp = http.NewServeMux() |
|
|
|
|
|
|
|
|
|
|
|
func Serve() { |
|
|
|
func Serve() { |
|
|
|
|
|
|
|
debugPtr := flag.Bool("debug", false, "Enables debug logging.") |
|
|
|
createConfig := flag.Bool("create-config", false, "Creates a basic configuration and exits") |
|
|
|
createConfig := flag.Bool("create-config", false, "Creates a basic configuration and exits") |
|
|
|
doConfig := flag.Bool("config", false, "Run the configuration process") |
|
|
|
doConfig := flag.Bool("config", false, "Run the configuration process") |
|
|
|
flag.Parse() |
|
|
|
flag.Parse() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
debugging = *debugPtr |
|
|
|
|
|
|
|
|
|
|
|
if *createConfig { |
|
|
|
if *createConfig { |
|
|
|
log.Info("Creating configuration...") |
|
|
|
log.Info("Creating configuration...") |
|
|
|
c := config.New() |
|
|
|
c := config.New() |
|
|
@ -70,6 +77,8 @@ func Serve() { |
|
|
|
cfg: cfg, |
|
|
|
cfg: cfg, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.cfg.Server.Dev = *debugPtr |
|
|
|
|
|
|
|
|
|
|
|
// Load keys
|
|
|
|
// Load keys
|
|
|
|
log.Info("Loading encryption keys...") |
|
|
|
log.Info("Loading encryption keys...") |
|
|
|
err = initKeys(app) |
|
|
|
err = initKeys(app) |
|
|
|