diff options
Diffstat (limited to 'lib/xdsconfig')
-rw-r--r-- | lib/xdsconfig/config.go | 16 |
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") +} |