aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xdsconfig
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-09-21 16:48:28 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-09-22 10:03:24 +0200
commit1966f9e786dfb67543401d181a374bd7f3856f37 (patch)
treef9fbc6628dd215c3287f8923956b4f19c97f7c1f /lib/xdsconfig
parentc6c53d11b08251056fba48f47b3e2349d6bed114 (diff)
Set default syncthing path.
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/xdsconfig')
-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,