Standardized XDS config file name and location.
authorSebastien Douheret <sebastien.douheret@iot.bzh>
Mon, 11 Dec 2017 10:05:55 +0000 (11:05 +0100)
committerSebastien Douheret <sebastien.douheret@iot.bzh>
Mon, 11 Dec 2017 14:46:53 +0000 (15:46 +0100)
- config file name is :  agent-config.json
- xds-agent settings under user's home is:  $HOME/.xds/agent
- xds-agent settings under etc is: /etc/xds/agent

Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Makefile
conf.d/etc/xds/agent/agent-config.json [moved from conf.d/etc/xds-agent/agent-config.json with 100% similarity]
conf.d/usr/lib/systemd/user/xds-agent.service
lib/agent/agent.go
lib/syncthing/st.go
lib/xdsconfig/configfile.go
scripts/install.sh

index 1d5c909..898b552 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -158,7 +158,7 @@ package: clean tools/syncthing vendor build
 ifneq ($(GOOS), windows)
                @cp -r $(ROOT_SRCDIR)/conf.d $(ROOT_SRCDIR)/scripts $(PACKAGE_DIR)/$(TARGET)/
 endif
-       @cp $(ROOT_SRCDIR)/conf.d/etc/xds-agent/agent-config.json $(PACKAGE_DIR)/$(TARGET)/agent-config.json.in
+       @cp $(ROOT_SRCDIR)/conf.d/etc/xds/agent/agent-config.json $(PACKAGE_DIR)/$(TARGET)/agent-config.json.in
        @cd $(PACKAGE_DIR) && zip -r $(ROOT_SRCDIR)/$(PACKAGE_ZIPFILE) ./$(TARGET)
        @echo "### Package $(PACKAGE_ZIPFILE) has been successfuly built - $(BUILD_MODE)"
 
index 1fd038b..6db084d 100644 (file)
@@ -3,7 +3,7 @@ Description=XDS Agent
 
 [Service]
 EnvironmentFile=-/etc/default/xds-agent
-ExecStart=/opt/AGL/xds/agent/xds-agent &
+ExecStart=/opt/AGL/xds/agent/xds-agent
 
 [Install]
 WantedBy=multi-user.target
index 58a2ba0..a562e77 100644 (file)
@@ -132,7 +132,7 @@ func (ctx *Context) Run() (int, error) {
                ctx._logPrint("Logging file for HTTP requests: %s\n", logFileHTTPReq)
        }
 
-       // Create syncthing instance when section "syncthing" is present in config.json
+       // Create syncthing instance when section "syncthing" is present in agent-config.json
        if ctx.Config.FileConf.SThgConf != nil {
                ctx.SThg = st.NewSyncThing(ctx.Config, ctx.Log)
        }
index ac1e99d..c4b72c5 100644 (file)
@@ -278,7 +278,7 @@ func (s *SyncThing) Start() (*exec.Cmd, error) {
        */
        s.STCmd, err = s.startProc("syncthing", args, env, &s.exitSTChan)
 
-       // Use autogenerated apikey if not set by config.json
+       // Use autogenerated apikey if not set by agent-config.json
        if err == nil && s.APIKey == "" {
                if fd, err := os.Open(filepath.Join(s.Home, "config.xml")); err == nil {
                        defer fd.Close()
index 71870d0..c252073 100644 (file)
@@ -55,7 +55,7 @@ type FileConfig struct {
 // Order to determine which config file is used:
 //  1/ from command line option: "--config myConfig.json"
 //  2/ $HOME/.xds/agent/agent-config.json file
-//  3/ /etc/xds-agent/config.json file
+//  3/ /etc/xds/agent/agent-config.json file
 
 func readGlobalConfig(c *Config, confFile string) error {
 
@@ -67,7 +67,7 @@ func readGlobalConfig(c *Config, confFile string) error {
                searchIn = append(searchIn, path.Join(homeDir, ".xds", "agent", "agent-config.json"))
        }
 
-       searchIn = append(searchIn, "/etc/xds-agent/agent-config.json")
+       searchIn = append(searchIn, "/etc/xds/agent/agent-config.json")
 
        var cFile *string
        for _, p := range searchIn {
index 10fc59f..444dc1b 100755 (executable)
@@ -28,7 +28,7 @@ install() {
     mkdir -p "${DESTDIR}" && cp "${ROOT_SRCDIR}/bin/*" "${DESTDIR}" || exit 1
     mkdir -p "${DESTDIR_WWW}" && cp -a "${ROOT_SRCDIR}/webapp/dist/*" "${DESTDIR_WWW}" || exit 1
 
-    cp "${ROOT_SRCDIR}/conf.d/etc/xds-agent" /etc/ || exit 1
+    cp -a "${ROOT_SRCDIR}/conf.d/etc/xds" /etc/ || exit 1
     cp "${ROOT_SRCDIR}/conf.d/etc/default/xds-agent" /etc/default/ || exit 1
 
     FILE=/etc/profile.d/xds-agent.sh