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.go27
1 files changed, 21 insertions, 6 deletions
diff --git a/lib/xdsconfig/config.go b/lib/xdsconfig/config.go
index f2d0710..82ca97f 100644
--- a/lib/xdsconfig/config.go
+++ b/lib/xdsconfig/config.go
@@ -2,7 +2,7 @@ package xdsconfig
import (
"fmt"
-
+ "io"
"os"
"github.com/Sirupsen/logrus"
@@ -16,11 +16,20 @@ 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)
- FileConf FileConfig `json:"-"`
- Log *logrus.Logger `json:"-"`
+ Options Options `json:"-"`
+ FileConf FileConfig `json:"-"`
+ Log *logrus.Logger `json:"-"`
+ LogVerboseOut io.Writer `json:"-"`
+}
+
+// Options set at the command line
+type Options struct {
+ ConfigFile string
+ LogLevel string
+ LogFile string
+ NoFolderConfig bool
}
// Config default values
@@ -41,7 +50,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 +67,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
}