Environment variable overrides (#74)
* Environment variable overrides * Remove ORCHARD_CONTEXT
This commit is contained in:
parent
316f785a0c
commit
fd1be695d4
10
README.md
10
README.md
|
|
@ -66,3 +66,13 @@ From architecture perspective, Orchard has a lower level API for port forwarding
|
|||
All port forwarding connections are done via the Orchard Controller instance which "proxies" a secure connection to the Orchard Workers.
|
||||
Therefore, your workers can be located under a stricter firewall that only allows connections to the Orchard Controller instance.
|
||||
Orchard Controller instance is secured by default and all API calls are authenticated and authorized.
|
||||
|
||||
### Environment variables
|
||||
|
||||
In addition to controlling the Orchard via the CLI arguments, there are environment variables that may be beneficial both when automating Orchard and in daily use:
|
||||
|
||||
| Variable name | Description |
|
||||
|---------------------------------|------------------------------------------------------------------------------------|
|
||||
| `ORCHARD_URL` | Override controller URL on per-command basis |
|
||||
| `ORCHARD_SERVICE_ACCOUNT_NAME` | Override service account name (used for controller API auth) on per-command basis |
|
||||
| `ORCHARD_SERVICE_ACCOUNT_TOKEN` | Override service account token (used for controller API auth) on per-command basis |
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package config
|
||||
|
||||
const (
|
||||
OrchardURL = "ORCHARD_URL"
|
||||
OrchardServiceAccountName = "ORCHARD_SERVICE_ACCOUNT_NAME"
|
||||
OrchardServiceAccountToken = "ORCHARD_SERVICE_ACCOUNT_TOKEN"
|
||||
)
|
||||
|
|
@ -116,6 +116,17 @@ func (handle *Handle) DefaultContext() (Context, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// Environment variable overrides
|
||||
if url, ok := os.LookupEnv(OrchardURL); ok {
|
||||
defaultContext.URL = url
|
||||
}
|
||||
if serviceAccountName, ok := os.LookupEnv(OrchardServiceAccountName); ok {
|
||||
defaultContext.ServiceAccountName = serviceAccountName
|
||||
}
|
||||
if serviceAccountToken, ok := os.LookupEnv(OrchardServiceAccountToken); ok {
|
||||
defaultContext.ServiceAccountToken = serviceAccountToken
|
||||
}
|
||||
|
||||
return defaultContext, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue