summaryrefslogtreecommitdiffstats
path: root/lib/xdsconfig/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/xdsconfig/config.go')
-rw-r--r--lib/xdsconfig/config.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/xdsconfig/config.go b/lib/xdsconfig/config.go
index f3cba4a..84e0778 100644
--- a/lib/xdsconfig/config.go
+++ b/lib/xdsconfig/config.go
@@ -38,6 +38,7 @@ const (
DefaultAPIVersion = "1"
DefaultPort = "8000"
DefaultShareDir = "${HOME}/.xds-server/projects"
+ DefaultSTHomeDir = "${HOME}/.xds-server/syncthing-config"
DefaultSdkRootDir = "/xdt/sdk"
)
@@ -45,6 +46,15 @@ const (
func Init(cliCtx *cli.Context, log *logrus.Logger) (*Config, error) {
var err error
+ dfltShareDir := DefaultShareDir
+ dfltSTHomeDir := DefaultSTHomeDir
+ if resDir, err := common.ResolveEnvVar(DefaultShareDir); err == nil {
+ dfltShareDir = resDir
+ }
+ if resDir, err := common.ResolveEnvVar(DefaultSTHomeDir); err == nil {
+ dfltSTHomeDir = resDir
+ }
+
// Define default configuration
c := Config{
Version: cliCtx.App.Metadata["version"].(string),
@@ -60,9 +70,10 @@ func Init(cliCtx *cli.Context, log *logrus.Logger) (*Config, error) {
},
FileConf: FileConfig{
WebAppDir: "webapp/dist",
- ShareRootDir: DefaultShareDir,
+ ShareRootDir: dfltShareDir,
SdkRootDir: DefaultSdkRootDir,
HTTPPort: DefaultPort,
+ SThgConf: &SyncThingConf{Home: dfltSTHomeDir},
LogsDir: "",
},
Log: log,