summaryrefslogtreecommitdiffstats
path: root/lib/xdsconfig
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xdsconfig')
-rw-r--r--lib/xdsconfig/config.go30
-rw-r--r--lib/xdsconfig/fileconfig.go26
2 files changed, 35 insertions, 21 deletions
diff --git a/lib/xdsconfig/config.go b/lib/xdsconfig/config.go
index 4ba97ef..bab3abd 100644
--- a/lib/xdsconfig/config.go
+++ b/lib/xdsconfig/config.go
@@ -53,12 +53,14 @@ type Options struct {
// Config default values
const (
- DefaultAPIVersion = "1"
- DefaultPort = "8000"
- DefaultShareDir = "projects"
- DefaultSTHomeDir = "syncthing-config"
- DefaultSdkScriptsDir = "${EXEPATH}/sdks"
- DefaultSdkDbUpdate = "startup"
+ DefaultAPIVersion = "1"
+ DefaultPort = "8000"
+ DefaultShareDir = "projects"
+ DefaultSTHomeDir = "syncthing-config"
+ DefaultSdkScriptsDir = "${EXEPATH}/sdks"
+ DefaultXdsUtilsScriptsDir = "${EXEPATH}/xds-utils"
+ DefaultSdkDbUpdate = "startup"
+ DefaultXdsSrvUpdateTime = "24h"
)
// Init loads the configuration on start-up
@@ -98,13 +100,15 @@ func Init(cliCtx *cli.Context, log *logrus.Logger) (*Config, error) {
NoFolderConfig: cliCtx.GlobalBool("no-folderconfig"),
},
FileConf: FileConfig{
- WebAppDir: "webapp/dist",
- ShareRootDir: dfltShareDir,
- SdkScriptsDir: DefaultSdkScriptsDir,
- SdkDbUpdate: DefaultSdkDbUpdate,
- HTTPPort: DefaultPort,
- SThgConf: &SyncThingConf{Home: dfltSTHomeDir},
- LogsDir: "",
+ WebAppDir: "webapp/dist",
+ ShareRootDir: dfltShareDir,
+ SdkScriptsDir: DefaultSdkScriptsDir,
+ XdsUtilsScriptsDir: DefaultXdsUtilsScriptsDir,
+ SdkDbUpdate: DefaultSdkDbUpdate,
+ HTTPPort: DefaultPort,
+ SThgConf: &SyncThingConf{Home: dfltSTHomeDir},
+ LogsDir: "",
+ XdsSrvUpdateTime: DefaultXdsSrvUpdateTime,
},
Log: log,
}
diff --git a/lib/xdsconfig/fileconfig.go b/lib/xdsconfig/fileconfig.go
index 374afa3..a3e0cee 100644
--- a/lib/xdsconfig/fileconfig.go
+++ b/lib/xdsconfig/fileconfig.go
@@ -50,13 +50,15 @@ type SyncThingConf struct {
// FileConfig is the JSON structure of xds-server config file (server-config.json)
type FileConfig struct {
- WebAppDir string `json:"webAppDir"`
- ShareRootDir string `json:"shareRootDir"`
- SdkScriptsDir string `json:"sdkScriptsDir"`
- SdkDbUpdate string `json:"sdkDbUpdate"`
- HTTPPort string `json:"httpPort"`
- SThgConf *SyncThingConf `json:"syncthing"`
- LogsDir string `json:"logsDir"`
+ WebAppDir string `json:"webAppDir"`
+ ShareRootDir string `json:"shareRootDir"`
+ SdkScriptsDir string `json:"sdkScriptsDir"`
+ XdsUtilsScriptsDir string `json:"xdsUtilsScriptsDir"`
+ SdkDbUpdate string `json:"sdkDbUpdate"`
+ HTTPPort string `json:"httpPort"`
+ SThgConf *SyncThingConf `json:"syncthing"`
+ LogsDir string `json:"logsDir"`
+ XdsSrvUpdateTime string `json:"xdsSrvUpdateTime"`
}
// readGlobalConfig reads configuration from a config file.
@@ -118,7 +120,9 @@ func readGlobalConfig(c *Config, confFile string) error {
&fCfg.WebAppDir,
&fCfg.ShareRootDir,
&fCfg.SdkScriptsDir,
- &fCfg.LogsDir}
+ &fCfg.XdsUtilsScriptsDir,
+ &fCfg.LogsDir,
+ &fCfg.XdsSrvUpdateTime}
if fCfg.SThgConf != nil {
vars = append(vars, &fCfg.SThgConf.Home, &fCfg.SThgConf.BinDir)
}
@@ -132,6 +136,9 @@ func readGlobalConfig(c *Config, confFile string) error {
if fCfg.SdkScriptsDir == "" {
fCfg.SdkScriptsDir = c.FileConf.SdkScriptsDir
}
+ if fCfg.XdsUtilsScriptsDir == "" {
+ fCfg.XdsUtilsScriptsDir = c.FileConf.XdsUtilsScriptsDir
+ }
if fCfg.SdkDbUpdate == "" {
fCfg.SdkDbUpdate = c.FileConf.SdkDbUpdate
}
@@ -141,6 +148,9 @@ func readGlobalConfig(c *Config, confFile string) error {
if fCfg.LogsDir == "" {
fCfg.LogsDir = c.FileConf.LogsDir
}
+ if fCfg.XdsSrvUpdateTime == "" {
+ fCfg.XdsSrvUpdateTime = c.FileConf.XdsSrvUpdateTime
+ }
for _, field := range vars {
var err error