diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-10-06 17:53:51 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-11-06 15:57:03 +0100 |
commit | 0e72ccd733207877bd8edca55fd6aed0877139e5 (patch) | |
tree | 948fd6eebea259c8a09b313427e0112433418d30 /lib/xdsconfig/config.go | |
parent | ac9e80f7f32a1c04c171a4d208f0ab7d3a5ca154 (diff) |
Cleanup and improvements
- Save server data into file
- FolderType is now a string
- cleanup useless code
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/xdsconfig/config.go')
-rw-r--r-- | lib/xdsconfig/config.go | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/xdsconfig/config.go b/lib/xdsconfig/config.go index 84e0778..2f1fa96 100644 --- a/lib/xdsconfig/config.go +++ b/lib/xdsconfig/config.go @@ -13,10 +13,12 @@ import ( // Config parameters (json format) of /config command type Config struct { - Version string `json:"version"` - APIVersion string `json:"apiVersion"` - VersionGitTag string `json:"gitTag"` - Builder BuilderConfig `json:"builder"` + ServerUID string `json:"id"` + Version string `json:"version"` + APIVersion string `json:"apiVersion"` + VersionGitTag string `json:"gitTag"` + SupportedSharing map[string]bool `json:"supportedSharing"` + Builder BuilderConfig `json:"builder"` // Private (un-exported fields in REST GET /config route) Options Options `json:"-"` @@ -55,12 +57,19 @@ func Init(cliCtx *cli.Context, log *logrus.Logger) (*Config, error) { dfltSTHomeDir = resDir } + uuid, err := ServerIDGet() + if err != nil { + return nil, err + } + // Define default configuration c := Config{ - Version: cliCtx.App.Metadata["version"].(string), - APIVersion: DefaultAPIVersion, - VersionGitTag: cliCtx.App.Metadata["git-tag"].(string), - Builder: BuilderConfig{}, + ServerUID: uuid, + Version: cliCtx.App.Metadata["version"].(string), + APIVersion: DefaultAPIVersion, + VersionGitTag: cliCtx.App.Metadata["git-tag"].(string), + Builder: BuilderConfig{}, + SupportedSharing: map[string]bool{ /*FIXME USE folder.TypePathMap*/ "PathMap": true}, Options: Options{ ConfigFile: cliCtx.GlobalString("config"), |