From 0b373092372692835cb8908bb56d2dd89d1ce88f Mon Sep 17 00:00:00 2001 From: andreimarcu Date: Sun, 25 Oct 2015 14:04:38 -0400 Subject: [PATCH] Allow configuration from ini-style file --- README.md | 10 ++++++++++ server.go | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 45b94e2..f92a11e 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,16 @@ Get release and run Usage ----- +#### Configuration +All configuration options are accepted either as arguments or can be placed in an ini-style file as such: +```ini +sitename = "my linx" +siteurl = "https://linx.example.com" +remoteuploads = true +# etc +``` +...and then invoke ```linx-server -config path/to/config.ini``` + #### Common options - ```-bind 127.0.0.1:8080``` -- what to bind to (default is 127.0.0.1:8080) - ```-sitename myLinx``` -- the site name displayed on top (default is linx) diff --git a/server.go b/server.go index aa145b0..c00b2c1 100644 --- a/server.go +++ b/server.go @@ -13,6 +13,7 @@ import ( "github.com/GeertJohan/go.rice" "github.com/flosch/pongo2" + "github.com/vharitonsky/iniflags" "github.com/zenazn/goji/graceful" "github.com/zenazn/goji/web" "github.com/zenazn/goji/web/middleware" @@ -194,7 +195,8 @@ func main() { "value of Content-Security-Policy header for file access") flag.StringVar(&Config.xFrameOptions, "xframeoptions", "SAMEORIGIN", "value of X-Frame-Options header") - flag.Parse() + + iniflags.Parse() mux := setup()