Skip to content

Commit 25e151c

Browse files
committed
feat: rename url env to upstream
url is still supported for now. But will be removed later.
1 parent bc1c109 commit 25e151c

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export OVERLEASH_URL=
1+
export OVERLEASH_UPSTREAM=
22
export OVERLEASH_TOKEN=
33
export NETWORK_NAME=network_name
44
export HOST_NAME=overleash.test

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ Setting the config for Overleash can be set in two ways, environment variable or
6464

6565
Here are the config options:
6666

67-
| Name | Value | Env | Flag |
68-
|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------|--------------------|
69-
| Unleash url | example: `https://unleash.my-site.com`, this url without `/api`, can be a Unleash instance or Unleash edge | `OVERLEASH_URL` | `--url` |
70-
| Reload frequency | default: `0`, example: `1`, value is in minutes, `0` is no reload | `OVERLEASH_RELOAD` | `--reload` |
71-
| Server port | default: `5433` | `OVERLEASH_PORT` | `--port` |
72-
| Unleash token (Client token) | example: `*:development.a2a6261d38fe4f9c86aceddce09a00df6c348fd0feeab3c24a9547f2` Token or tokens that are used to fetch the feature flag config from upstream unleash. | `OVERLEASH_TOKEN` | `--token` |
73-
| Verbose | default: `false` Logs a bit more information for diagnose issues | `OVERLEASH_VERBOSE` | `--verbose` |
74-
| Proxy metrics to upstream | default: `false` Proxy the metric calls to the upstream. Make sure the correct token are in the authorization header. | `OVERLEASH_PROXY_METRICS` | `--proxy-metrics` |
67+
| Name | Value | Env | Flag |
68+
|-------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------|--------------------|
69+
| Unleash upstream url | example: `https://unleash.my-site.com`, this url without `/api`, can be a Unleash instance or Unleash edge | `OVERLEASH_UPSTREAM` | `--upstream` |
70+
| Reload frequency | default: `0`, example: `1`, value is in minutes, `0` is no reload | `OVERLEASH_RELOAD` | `--reload` |
71+
| Server port | default: `5433` | `OVERLEASH_PORT` | `--port` |
72+
| Unleash token (Client token) | example: `*:development.a2a6261d38fe4f9c86aceddce09a00df6c348fd0feeab3c24a9547f2` Token or tokens that are used to fetch the feature flag config from upstream unleash. | `OVERLEASH_TOKEN` | `--token` |
73+
| Verbose | default: `false` Logs a bit more information for diagnose issues | `OVERLEASH_VERBOSE` | `--verbose` |
74+
| Proxy metrics to upstream | default: `false` Proxy the metric calls to the upstream. Make sure the correct token are in the authorization header. | `OVERLEASH_PROXY_METRICS` | `--proxy-metrics` |
7575

7676
## API Endpoints
7777
### Client API

docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ services:
1111
- overleash-data:/data
1212
environment:
1313
- OVERLEASH_URL=${OVERLEASH_URL}
14+
- OVERLEASH_UPSTREAM=${OVERLEASH_UPSTREAM}
1415
- OVERLEASH_TOKEN=${OVERLEASH_TOKEN}
1516
- OVERLEASH_RELOAD=${OVERLEASH_RELOAD}
1617
- TZ=${TZ}

helm/overleash/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ persistence:
131131
annotations: {}
132132

133133
extraEnv:
134-
OVERLEASH_URL: "http://unleash.unleash:4242"
134+
OVERLEASH_UPSTREAM: ""
135135
OVERLEASH_TOKEN: ""
136136
OVERLEASH_RELOAD: "1"
137137
OVERLEASH_VERBOSE: "false"

main.go

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@ func run(ctx context.Context) {
2323
port := viper.GetInt("port")
2424
proxyMetrics := viper.GetBool("proxy_metrics")
2525

26-
o := overleash.NewOverleash(viper.GetString("url"), tokens, reload)
26+
upstream := viper.GetString("upstream")
27+
if upstream == "" {
28+
upstream = viper.GetString("url")
29+
if upstream != "" {
30+
log.Warn("The 'url' flag is deprecated. Please use the 'upstream' flag instead.")
31+
}
32+
}
33+
34+
o := overleash.NewOverleash(upstream, tokens, reload)
2735
o.Start(ctx)
2836

2937
server.New(o, port, proxyMetrics, ctx).Start()
@@ -47,12 +55,14 @@ func initConfig() {
4755
viper.AutomaticEnv()
4856
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
4957

50-
pflag.String("url", "", "Upstream to load")
51-
pflag.String("token", "", "Token to load")
52-
pflag.String("port", "5433", "Port")
53-
pflag.Int("reload", 0, "Reload")
54-
pflag.Bool("verbose", false, "Verbose mode")
55-
pflag.Bool("proxy_metrics", false, "Proxy metrics")
58+
pflag.String("url", "", "DEPRECATED: Unleash URL (e.g. https://unleash.my-site.com) without /api. Use --upstream instead.")
59+
pflag.String("upstream", "", "Unleash upstream URL to load feature flags (e.g. https://unleash.my-site.com) without /api, can be an Unleash instance or Unleash Edge.")
60+
pflag.String("token", "", "Comma-separated Unleash client token(s) to fetch feature flag configurations.")
61+
pflag.String("port", "5433", "Port number on which Overleash will listen (default: 5433).")
62+
pflag.Int("reload", 0, "Reload frequency in minutes for refreshing feature flag configuration (0 disables automatic reloading).")
63+
pflag.Bool("verbose", false, "Enable verbose logging to troubleshoot and diagnose issues.")
64+
pflag.Bool("proxy_metrics", false, "Proxy metrics requests to the upstream Unleash server (ensure that the correct token is provided in the authorization header).")
65+
5666
pflag.Parse()
5767

5868
viper.BindPFlags(pflag.CommandLine)

0 commit comments

Comments
 (0)