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/fileconfig.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/fileconfig.go')
-rw-r--r-- | lib/xdsconfig/fileconfig.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/xdsconfig/fileconfig.go b/lib/xdsconfig/fileconfig.go index 2651caf..39560a4 100644 --- a/lib/xdsconfig/fileconfig.go +++ b/lib/xdsconfig/fileconfig.go @@ -16,6 +16,8 @@ const ( ConfigDir = ".xds-server" // GlobalConfigFilename Global config filename GlobalConfigFilename = "config.json" + // ServerDataFilename Server data filename + ServerDataFilename = "server-data.xml" // FoldersConfigFilename Folders config filename FoldersConfigFilename = "server-config_folders.xml" ) @@ -146,11 +148,20 @@ func readGlobalConfig(c *Config, confFile string) error { return nil } -// FoldersConfigFilenameGet -func FoldersConfigFilenameGet() (string, error) { +func configFilenameGet(cfgFile string) (string, error) { usr, err := user.Current() if err != nil { return "", err } - return path.Join(usr.HomeDir, ConfigDir, FoldersConfigFilename), nil + return path.Join(usr.HomeDir, ConfigDir, cfgFile), nil +} + +// FoldersConfigFilenameGet +func FoldersConfigFilenameGet() (string, error) { + return configFilenameGet(FoldersConfigFilename) +} + +// ServerDataFilenameGet +func ServerDataFilenameGet() (string, error) { + return configFilenameGet(ServerDataFilename) } |