aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xdsconfig/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xdsconfig/config.go')
-rw-r--r--lib/xdsconfig/config.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/xdsconfig/config.go b/lib/xdsconfig/config.go
index f2d0710..a3e5a7e 100644
--- a/lib/xdsconfig/config.go
+++ b/lib/xdsconfig/config.go
@@ -2,7 +2,6 @@ package xdsconfig
import (
"fmt"
-
"os"
"github.com/Sirupsen/logrus"
@@ -16,13 +15,21 @@ type Config struct {
APIVersion string `json:"apiVersion"`
VersionGitTag string `json:"gitTag"`
Builder BuilderConfig `json:"builder"`
- Folders FoldersConfig `json:"folders"`
// Private (un-exported fields in REST GET /config route)
+ Options Options `json:"-"`
FileConf FileConfig `json:"-"`
Log *logrus.Logger `json:"-"`
}
+// Options set at the command line
+type Options struct {
+ ConfigFile string
+ LogLevel string
+ LogFile string
+ NoFolderConfig bool
+}
+
// Config default values
const (
DefaultAPIVersion = "1"
@@ -41,7 +48,13 @@ func Init(cliCtx *cli.Context, log *logrus.Logger) (*Config, error) {
APIVersion: DefaultAPIVersion,
VersionGitTag: cliCtx.App.Metadata["git-tag"].(string),
Builder: BuilderConfig{},
- Folders: FoldersConfig{},
+
+ Options: Options{
+ ConfigFile: cliCtx.GlobalString("config"),
+ LogLevel: cliCtx.GlobalString("log"),
+ LogFile: cliCtx.GlobalString("logfile"),
+ NoFolderConfig: cliCtx.GlobalBool("no-folderconfig"),
+ },
FileConf: FileConfig{
WebAppDir: "webapp/dist",
ShareRootDir: DefaultShareDir,
@@ -52,7 +65,7 @@ func Init(cliCtx *cli.Context, log *logrus.Logger) (*Config, error) {
}
// config file settings overwrite default config
- err = updateConfigFromFile(&c, cliCtx.GlobalString("config"))
+ err = readGlobalConfig(&c, c.Options.ConfigFile)
if err != nil {
return nil, err
}