8000 refactor: change env config variable from slinky_config -> connect_config by technicallyty · Pull Request #756 · skip-mev/connect · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

refactor: change env config variable from slinky_config -> connect_config #756

Merged
merged 3 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/connect/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const (
DefaultPort = "8080"
// jsonFieldDelimiter is the delimiter used to separate fields in the JSON output.
jsonFieldDelimiter = "."
// SlinkyConfigEnvironmentPrefix is the prefix for environment variables that override the slinky config.
SlinkyConfigEnvironmentPrefix = "SLINKY_CONFIG"
// ConnectConfigEnvironmentPrefix is the prefix for environment variables that override the connect config.
ConnectConfigEnvironmentPrefix = "CONNECT_CONFIG"
// TelemetryPushAddress is the value for the publication endpoint.
TelemetryPushAddress = "connect-statsd-data.dev.skip.money:9125"
)
Expand Down Expand Up @@ -100,7 +100,7 @@ func setViperDefaultsForDataStructure(keyPrefix string, config interface{}) {
}

// set the environment prefix
viper.SetEnvPrefix(SlinkyConfigEnvironmentPrefix)
viper.SetEnvPrefix(ConnectConfigEnvironmentPrefix)
viper.AutomaticEnv()
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
}
Expand Down
12 changes: 6 additions & 6 deletions cmd/connect/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ func TestReadOracleConfigWithOverrides(t *testing.T) {

t.Run("overriding variables from environment", func(t *testing.T) {
// set the environment variables
t.Setenv(cmdconfig.SlinkyConfigEnvironmentPrefix+"_UPDATEINTERVAL", updateIntervalOverride.String())
t.Setenv(cmdconfig.SlinkyConfigEnvironmentPrefix+"_METRICS_PROMETHEUSSERVERADDRESS", prometheusServerOverride)
t.Setenv(cmdconfig.SlinkyConfigEnvironmentPrefix+"_PROVIDERS_RAYDIUM_API_API_ENDPOINTS_1_URL", endpointOverride.URL)
t.Setenv(cmdconfig.SlinkyConfigEnvironmentPrefix+"_PROVIDERS_RAYDIUM_API_API_ENDPOINTS_1_AUTHENTICATION_APIKEY", endpointOverride.Authentication.APIKey)
t.Setenv(cmdconfig.SlinkyConfigEnvironmentPrefix+"_PROVIDERS_RAYDIUM_API_API_ENDPOINTS_1_AUTHENTICATION_APIKEYHEADER", endpointOverride.Authentication.APIKeyHeader)
t.Setenv(cmdconfig.SlinkyConfigEnvironmentPrefix+"_PROVIDERS_COINBASE_WS_WEBSOCKET_ENDPOINTS_0_URL", endpointOverride.URL)
t.Setenv(cmdconfig.ConnectConfigEnvironmentPrefix+"_UPDATEINTERVAL", updateIntervalOverride.String())
t.Setenv(cmdconfig.ConnectConfigEnvironmentPrefix+"_METRICS_PROMETHEUSSERVERADDRESS", prometheusServerOverride)
t.Setenv(cmdconfig.ConnectConfigEnvironmentPrefix+"_PROVIDERS_RAYDIUM_API_API_ENDPOINTS_1_URL", endpointOverride.URL)
t.Setenv(cmdconfig.ConnectConfigEnvironmentPrefix+"_PROVIDERS_RAYDIUM_API_API_ENDPOINTS_1_AUTHENTICATION_APIKEY", endpointOverride.Authentication.APIKey)
t.Setenv(cmdconfig.ConnectConfigEnvironmentPrefix+"_PROVIDERS_RAYDIUM_API_API_ENDPOINTS_1_AUTHENTICATION_APIKEYHEADER", endpointOverride.Authentication.APIKeyHeader)
t.Setenv(cmdconfig.ConnectConfigEnvironmentPrefix+"_PROVIDERS_COINBASE_WS_WEBSOCKET_ENDPOINTS_0_URL", endpointOverride.URL)

cfg, err := cmdconfig.ReadOracleConfigWithOverrides("", marketmap.Name)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion contrib/compose/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ services:
context: ../..
dockerfile: ./contrib/images/connect.sidecar.dev.Dockerfile
environment:
- SLINKY_CONFIG_UPDATEINTERVAL=${SLINKY_CONFIG_UPDATEINTERVAL:-250ms}
- CONNECT_CONFIG_UPDATEINTERVAL=${CONNECT_CONFIG_UPDATEINTERVAL:-250ms}
entrypoint: [
"connect",
"--market-config-path", "/data/markets.json",
Expand Down
8 changes: 4 additions & 4 deletions docs/validators/configuration.mdx
950F
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ The following values are read via environment variables:

| Key | Default | Description |
|-------------------------------------------------|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
| `SLINKY_CONFIG_HOST` | `"0.0.0.0"` | The address Connect will serve requests from. WARNING: changing this value requires updating the `oracle_address` in the `app.toml` configuration. |
| `SLINKY_CONFIG_PORT` | `"8080"` | The port Connect will serve requests from. WARNING: changing this value requires updating the `oracle_address` in the `app.toml` configuration. |
| `SLINKY_CONFIG_METRICS_ENABLED` | `"true"` | Enables prometheus metrics. |
| `SLINKY_CONFIG_METRICS_PROMETHEUSSERVERADDRESS` | `"0.0.0.0:8002"` | The address of your prometheus server instance. |
| `CONNECT_CONFIG_HOST` | `"0.0.0.0"` | The address Connect will serve requests from. WARNING: changing this value requires updating the `oracle_address` in the `app.toml` configuration. |
| `CONNECT_CONFIG_PORT` | `"8080"` | The port Connect will serve requests from. WARNING: changing this value requires updating the `oracle_address` in the `app.toml` configuration. |
| `CONNECT_CONFIG_METRICS_ENABLED` | `"true"` | Enables prometheus metrics. |
| `CONNECT_CONFIG_METRICS_PROMETHEUSSERVERADDRESS` | `"0.0.0.0:8002"` | The address of your prometheus server instance. |


### Flags
Expand Down
Loading
0