aboutsummaryrefslogtreecommitdiffstats
path: root/lib/xdsconfig/fileconfig.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-05-16 22:51:32 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-05-17 14:04:32 +0200
commitc07adb807c41a1545a9a0f5bbf40080d86946538 (patch)
tree21e00efbcd03360416698663a1ea89536717ae86 /lib/xdsconfig/fileconfig.go
parent8983eebdbe74489d62eae4097580fc430d75bd07 (diff)
Auto start Syncthing and Syncthing-inotify.
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/xdsconfig/fileconfig.go')
-rw-r--r--lib/xdsconfig/fileconfig.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/xdsconfig/fileconfig.go b/lib/xdsconfig/fileconfig.go
index 7370ed0..3daf77c 100644
--- a/lib/xdsconfig/fileconfig.go
+++ b/lib/xdsconfig/fileconfig.go
@@ -12,23 +12,25 @@ import (
)
type SyncThingConf struct {
+ BinDir string `json:"binDir"`
Home string `json:"home"`
GuiAddress string `json:"gui-address"`
GuiAPIKey string `json:"gui-apikey"`
}
type FileConfig struct {
- WebAppDir string `json:"webAppDir"`
- ShareRootDir string `json:"shareRootDir"`
- HTTPPort string `json:"httpPort"`
- SThgConf SyncThingConf `json:"syncthing"`
+ WebAppDir string `json:"webAppDir"`
+ ShareRootDir string `json:"shareRootDir"`
+ HTTPPort string `json:"httpPort"`
+ SThgConf *SyncThingConf `json:"syncthing"`
+ LogsDir string `json:"logsDir"`
}
// getConfigFromFile reads configuration from a config file.
// Order to determine which config file is used:
// 1/ from command line option: "--config myConfig.json"
// 2/ $HOME/.xds/config.json file
-// 3/ <current_dir>/agent-config.json file
+// 3/ <current_dir>/config.json file
// 4/ <xds-server executable dir>/config.json file
func updateConfigFromFile(c *Config, confFile string) error {
@@ -73,7 +75,7 @@ func updateConfigFromFile(c *Config, confFile string) error {
if err := json.NewDecoder(fd).Decode(&fCfg); err != nil {
return err
}
- c.fileConf = fCfg
+ c.FileConf = fCfg
// Support environment variables (IOW ${MY_ENV_VAR} syntax) in config.json
// TODO: better to use reflect package to iterate on fields and be more generic