mirror of https://github.com/perkeep/perkeep.git
client: add CAMLI_DEFAULT_SERVER env option for selecting default server
For demos, when we want to show using camput/camget but select the devcam server instead of our production servers. Change-Id: Ie2adfd4f80df3119a705b51bb9736c3b66612d1c
This commit is contained in:
parent
e808a81beb
commit
b7230b2897
|
@ -45,6 +45,11 @@ CAMLI_DEBUG_CONFIG (bool):
|
|||
CAMLI_DEBUG_UPLOADS (bool):
|
||||
Used by pkg/client to enable additional logging.
|
||||
|
||||
CAMLI_DEFAULT_SERVER (string):
|
||||
The server alias to use by default. The string is the server's alias key
|
||||
in the client-config.json "servers" object. If set, the CAMLI_DEFAULT_SERVER
|
||||
takes precedence over the "default" bool in client-config.json.
|
||||
|
||||
CAMLI_DEV_CAMLI_ROOT (string):
|
||||
If set, the base directory of Camlistore when in dev mode.
|
||||
Used by pkg/server for finding static assests (js, css, html).
|
||||
|
|
|
@ -257,8 +257,9 @@ func serverOrDie() string {
|
|||
|
||||
func defaultServer() string {
|
||||
configOnce.Do(parseConfig)
|
||||
for _, serverConf := range config.Servers {
|
||||
if serverConf.IsDefault {
|
||||
wantAlias := os.Getenv("CAMLI_DEFAULT_SERVER")
|
||||
for alias, serverConf := range config.Servers {
|
||||
if (wantAlias != "" && wantAlias == alias) || (wantAlias == "" && serverConf.IsDefault) {
|
||||
return cleanServer(serverConf.Server)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue