mirror of
https://github.com/writefreely/writefreely
synced 2024-11-10 11:24:13 +00:00
Add --create-config flag to generate default config
This commit is contained in:
parent
5034cfdf11
commit
af601d7b0c
2 changed files with 13 additions and 0 deletions
12
app.go
12
app.go
|
@ -1,6 +1,7 @@
|
|||
package writefreely
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
"net/http"
|
||||
|
@ -28,6 +29,17 @@ type app struct {
|
|||
var shttp = http.NewServeMux()
|
||||
|
||||
func Serve() {
|
||||
createConfig := flag.Bool("create-config", false, "Creates a basic configuration and exits")
|
||||
flag.Parse()
|
||||
|
||||
if *createConfig {
|
||||
log.Info("Creating configuration...")
|
||||
c := config.New()
|
||||
log.Info("Saving configuration...")
|
||||
config.Save(c)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
log.Info("Initializing...")
|
||||
|
||||
log.Info("Loading configuration...")
|
||||
|
|
|
@ -51,6 +51,7 @@ func New() *Config {
|
|||
Database: DatabaseCfg{
|
||||
Type: "mysql",
|
||||
Host: "localhost",
|
||||
Port: 3306,
|
||||
},
|
||||
App: AppCfg{
|
||||
Federation: true,
|
||||
|
|
Loading…
Reference in a new issue