summaryrefslogtreecommitdiffstats
path: root/lib/xdsconfig
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-07-20 15:17:21 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-07-20 15:17:21 +0200
commit75ddecfe3c675855304f8ffa96a7d5dd3b8dae33 (patch)
tree395204c49622e4392c70b24a415ac847fba7c24d /lib/xdsconfig
parentb7bc9102de461eb880d951f16bdd9ded74e43a4f (diff)
Add XDS_SERVER_WORKSPACE_DIR env var supportflounder_5.99.2flounder/5.99.25.99.2
By default xds-server uses $HOME/xds-workspace directory to access to user shared workspace directory. This root directory may be changed by defining XDS_SERVER_WORKSPACE_DIR environment variable. Change-Id: Ib786ba9a954b0b093216295d37236a80f78f2f2c Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/xdsconfig')
-rw-r--r--lib/xdsconfig/config.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/xdsconfig/config.go b/lib/xdsconfig/config.go
index ca5b5cb..4ba97ef 100644
--- a/lib/xdsconfig/config.go
+++ b/lib/xdsconfig/config.go
@@ -174,3 +174,19 @@ func ConfigRootDir() string {
return path.Join(root, "/.xds/server")
}
+
+// WorkspaceRootDir return the path on server side where user xds-workspace dir is accessible
+func WorkspaceRootDir() string {
+ // May be overloaded by an env variable
+ if envVar, envDef := os.LookupEnv("XDS_SERVER_WORKSPACE_DIR"); envDef {
+ return envVar
+ }
+
+ home := "${HOME}"
+ if usr, err := user.Current(); err == nil {
+ home = usr.HomeDir
+ }
+
+ // Default value $HOME/xds-workspace
+ return path.Join(home, "xds-workspace")
+}