X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=lib%2Fxdsconfig%2Ffileconfig.go;h=86f39b5bdf64508603850822c86cb6542baefc43;hb=65e09e831cf13343ac713fbf15281174d1f13a94;hp=8e77de7802f92687fe5fc318f44e48db6dd7fe47;hpb=963931e04d44a5b40d38817163f52f56241a9f33;p=src%2Fxds%2Fxds-server.git diff --git a/lib/xdsconfig/fileconfig.go b/lib/xdsconfig/fileconfig.go index 8e77de7..86f39b5 100644 --- a/lib/xdsconfig/fileconfig.go +++ b/lib/xdsconfig/fileconfig.go @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 "IoT.bzh" + * Copyright (C) 2017-2018 "IoT.bzh" * Author Sebastien Douheret * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,7 +25,7 @@ import ( "path/filepath" "strings" - common "github.com/iotbzh/xds-common/golib" + common "gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git/golib" ) // ConfigDir Directory in user HOME directory where xds config will be saved @@ -38,6 +38,8 @@ const ( ServerDataFilename = "server-data.xml" // FoldersConfigFilename Folders config filename FoldersConfigFilename = "server-config_folders.xml" + // TargetsConfigFilename Targets config filename + TargetsConfigFilename = "server-config_targets.xml" ) // SyncThingConf definition @@ -51,12 +53,13 @@ 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"` - SdkRootDir string `json:"sdkRootDir"` - HTTPPort string `json:"httpPort"` - SThgConf *SyncThingConf `json:"syncthing"` - LogsDir string `json:"logsDir"` + 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"` } // readGlobalConfig reads configuration from a config file. @@ -117,7 +120,7 @@ func readGlobalConfig(c *Config, confFile string) error { vars := []*string{ &fCfg.WebAppDir, &fCfg.ShareRootDir, - &fCfg.SdkRootDir, + &fCfg.SdkScriptsDir, &fCfg.LogsDir} if fCfg.SThgConf != nil { vars = append(vars, &fCfg.SThgConf.Home, &fCfg.SThgConf.BinDir) @@ -136,8 +139,11 @@ func readGlobalConfig(c *Config, confFile string) error { if fCfg.ShareRootDir == "" { fCfg.ShareRootDir = c.FileConf.ShareRootDir } - if fCfg.SdkRootDir == "" { - fCfg.SdkRootDir = c.FileConf.SdkRootDir + if fCfg.SdkScriptsDir == "" { + fCfg.SdkScriptsDir = c.FileConf.SdkScriptsDir + } + if fCfg.SdkDbUpdate == "" { + fCfg.SdkDbUpdate = c.FileConf.SdkDbUpdate } if fCfg.HTTPPort == "" { fCfg.HTTPPort = c.FileConf.HTTPPort @@ -173,12 +179,17 @@ func configFilenameGet(cfgFile string) (string, error) { return path.Join(usr.HomeDir, ConfigDir, cfgFile), nil } -// FoldersConfigFilenameGet +// FoldersConfigFilenameGet Return the FoldersConfig filename func FoldersConfigFilenameGet() (string, error) { return configFilenameGet(FoldersConfigFilename) } -// ServerDataFilenameGet +// TargetsConfigFilenameGet Return the TargetsConfig filename +func TargetsConfigFilenameGet() (string, error) { + return configFilenameGet(TargetsConfigFilename) +} + +// ServerDataFilenameGet Return the ServerData filename func ServerDataFilenameGet() (string, error) { return configFilenameGet(ServerDataFilename) }