Skip to content

Commit

Permalink
refactor: rename env variables
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Gateru <[email protected]>
  • Loading branch information
felixgateru committed Jan 9, 2025
1 parent a8dec86 commit c1b5d1a
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 74 deletions.
30 changes: 15 additions & 15 deletions cmd/bootstrap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ import (

const (
svcName = "bootstrap"
envPrefixDB = "SMQ_BOOTSTRAP_DB_"
envPrefixHTTP = "SMQ_BOOTSTRAP_HTTP_"
envPrefixDB = "MG_BOOTSTRAP_DB_"
envPrefixHTTP = "MG_BOOTSTRAP_HTTP_"
envPrefixAuth = "SMQ_AUTH_GRPC_"
envPrefixDomains = "SMQ_DOMAINS_GRPC_"
defDB = "bootstrap"
Expand All @@ -62,19 +62,19 @@ const (
)

type config struct {
LogLevel string `env:"SMQ_BOOTSTRAP_LOG_LEVEL" envDefault:"info"`
EncKey string `env:"SMQ_BOOTSTRAP_ENCRYPT_KEY" envDefault:"12345678910111213141516171819202"`
ESConsumerName string `env:"SMQ_BOOTSTRAP_EVENT_CONSUMER" envDefault:"bootstrap"`
ClientsURL string `env:"SMQ_CLIENTS_URL" envDefault:"http://localhost:9006"`
ChannelsURL string `env:"SMQ_CHANNELS_URL" envDefault:"http://localhost:9005"`
JaegerURL url.URL `env:"SMQ_JAEGER_URL" envDefault:"http://localhost:4318/v1/traces"`
SendTelemetry bool `env:"SMQ_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"SMQ_BOOTSTRAP_INSTANCE_ID" envDefault:""`
ESURL string `env:"SMQ_ES_URL" envDefault:"nats://localhost:4222"`
TraceRatio float64 `env:"SMQ_JAEGER_TRACE_RATIO" envDefault:"1.0"`
SpicedbHost string `env:"SMQ_SPICEDB_HOST" envDefault:"localhost"`
SpicedbPort string `env:"SMQ_SPICEDB_PORT" envDefault:"50051"`
SpicedbPreSharedKey string `env:"SMQ_SPICEDB_PRE_SHARED_KEY" envDefault:"12345678"`
LogLevel string `env:"MG_BOOTSTRAP_LOG_LEVEL" envDefault:"info"`
EncKey string `env:"MG_BOOTSTRAP_ENCRYPT_KEY" envDefault:"12345678910111213141516171819202"`
ESConsumerName string `env:"MG_BOOTSTRAP_EVENT_CONSUMER" envDefault:"bootstrap"`
ClientsURL string `env:"SMQ_CLIENTS_URL" envDefault:"http://localhost:9006"`
ChannelsURL string `env:"SMQ_CHANNELS_URL" envDefault:"http://localhost:9005"`
JaegerURL url.URL `env:"SMQ_JAEGER_URL" envDefault:"http://localhost:4318/v1/traces"`
SendTelemetry bool `env:"SMQ_SEND_TELEMETRY" envDefault:"true"`
InstanceID string `env:"MG_BOOTSTRAP_INSTANCE_ID" envDefault:""`
ESURL string `env:"SMQ_ES_URL" envDefault:"nats://localhost:4222"`
TraceRatio float64 `env:"SMQ_JAEGER_TRACE_RATIO" envDefault:"1.0"`
SpicedbHost string `env:"SMQ_SPICEDB_HOST" envDefault:"localhost"`
SpicedbPort string `env:"SMQ_SPICEDB_PORT" envDefault:"50051"`
SpicedbPreSharedKey string `env:"SMQ_SPICEDB_PRE_SHARED_KEY" envDefault:"12345678"`
}

func main() {
Expand Down
76 changes: 38 additions & 38 deletions docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -397,46 +397,46 @@ SMQ_WS_ADAPTER_INSTANCE_ID=

## Addons Services
### Bootstrap
SMQ_BOOTSTRAP_LOG_LEVEL=debug
SMQ_BOOTSTRAP_ENCRYPT_KEY=v7aT0HGxJxt2gULzr3RHwf4WIf6DusPp
SMQ_BOOTSTRAP_EVENT_CONSUMER=bootstrap
SMQ_BOOTSTRAP_HTTP_HOST=bootstrap
SMQ_BOOTSTRAP_HTTP_PORT=9013
SMQ_BOOTSTRAP_HTTP_SERVER_CERT=
SMQ_BOOTSTRAP_HTTP_SERVER_KEY=
SMQ_BOOTSTRAP_DB_HOST=bootstrap-db
SMQ_BOOTSTRAP_DB_PORT=5432
SMQ_BOOTSTRAP_DB_USER=magistrala
SMQ_BOOTSTRAP_DB_PASS=magistrala
SMQ_BOOTSTRAP_DB_NAME=bootstrap
SMQ_BOOTSTRAP_DB_SSL_MODE=disable
SMQ_BOOTSTRAP_DB_SSL_CERT=
SMQ_BOOTSTRAP_DB_SSL_KEY=
SMQ_BOOTSTRAP_DB_SSL_ROOT_CERT=
SMQ_BOOTSTRAP_INSTANCE_ID=
MG_BOOTSTRAP_LOG_LEVEL=debug
MG_BOOTSTRAP_ENCRYPT_KEY=v7aT0HGxJxt2gULzr3RHwf4WIf6DusPp
MG_BOOTSTRAP_EVENT_CONSUMER=bootstrap
MG_BOOTSTRAP_HTTP_HOST=bootstrap
MG_BOOTSTRAP_HTTP_PORT=9013
MG_BOOTSTRAP_HTTP_SERVER_CERT=
MG_BOOTSTRAP_HTTP_SERVER_KEY=
MG_BOOTSTRAP_DB_HOST=bootstrap-db
MG_BOOTSTRAP_DB_PORT=5432
MG_BOOTSTRAP_DB_USER=magistrala
MG_BOOTSTRAP_DB_PASS=magistrala
MG_BOOTSTRAP_DB_NAME=bootstrap
MG_BOOTSTRAP_DB_SSL_MODE=disable
MG_BOOTSTRAP_DB_SSL_CERT=
MG_BOOTSTRAP_DB_SSL_KEY=
MG_BOOTSTRAP_DB_SSL_ROOT_CERT=
MG_BOOTSTRAP_INSTANCE_ID=

### Provision
SMQ_PROVISION_CONFIG_FILE=/configs/config.toml
SMQ_PROVISION_LOG_LEVEL=debug
SMQ_PROVISION_HTTP_PORT=9016
SMQ_PROVISION_ENV_CLIENTS_TLS=false
SMQ_PROVISION_SERVER_CERT=
SMQ_PROVISION_SERVER_KEY=
SMQ_PROVISION_USERS_LOCATION=http://users:9002
SMQ_PROVISION_CLIENTS_LOCATION=http://clients:9006
SMQ_PROVISION_USER=
SMQ_PROVISION_USERNAME=
SMQ_PROVISION_PASS=
SMQ_PROVISION_API_KEY=
SMQ_PROVISION_CERTS_SVC_URL=http://certs:9019
SMQ_PROVISION_X509_PROVISIONING=false
SMQ_PROVISION_BS_SVC_URL=http://bootstrap:9013
SMQ_PROVISION_BS_CONFIG_PROVISIONING=true
SMQ_PROVISION_BS_AUTO_WHITELIST=true
SMQ_PROVISION_BS_CONTENT=
SMQ_PROVISION_CERTS_HOURS_VALID=2400h
SMQ_PROVISION_CERTS_RSA_BITS=2048
SMQ_PROVISION_INSTANCE_ID=
MG_PROVISION_CONFIG_FILE=/configs/config.toml
MG_PROVISION_LOG_LEVEL=debug
MG_PROVISION_HTTP_PORT=9016
MG_PROVISION_ENV_CLIENTS_TLS=false
MG_PROVISION_SERVER_CERT=
MG_PROVISION_SERVER_KEY=
MG_PROVISION_USERS_LOCATION=http://users:9002
MG_PROVISION_CLIENTS_LOCATION=http://clients:9006
MG_PROVISION_USER=
MG_PROVISION_USERNAME=
MG_PROVISION_PASS=
MG_PROVISION_API_KEY=
MG_PROVISION_CERTS_SVC_URL=http://certs:9019
MG_PROVISION_X509_PROVISIONING=false
MG_PROVISION_BS_SVC_URL=http://bootstrap:9013
MG_PROVISION_BS_CONFIG_PROVISIONING=true
MG_PROVISION_BS_AUTO_WHITELIST=true
MG_PROVISION_BS_CONTENT=
MG_PROVISION_CERTS_HOURS_VALID=2400h
MG_PROVISION_CERTS_RSA_BITS=2048
MG_PROVISION_INSTANCE_ID=

### Vault
SMQ_VAULT_HOST=vault
Expand Down
42 changes: 21 additions & 21 deletions docker/addons/bootstrap/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ services:
container_name: magistrala-bootstrap-db
restart: on-failure
environment:
POSTGRES_USER: ${SMQ_BOOTSTRAP_DB_USER}
POSTGRES_PASSWORD: ${SMQ_BOOTSTRAP_DB_PASS}
POSTGRES_DB: ${SMQ_BOOTSTRAP_DB_NAME}
POSTGRES_USER: ${MG_BOOTSTRAP_DB_USER}
POSTGRES_PASSWORD: ${MG_BOOTSTRAP_DB_PASS}
POSTGRES_DB: ${MG_BOOTSTRAP_DB_NAME}
networks:
- magistrala-base-net
volumes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:
SMQ_JAEGER_URL: ${SMQ_JAEGER_URL}
SMQ_JAEGER_TRACE_RATIO: ${SMQ_JAEGER_TRACE_RATIO}
SMQ_SEND_TELEMETRY: ${SMQ_SEND_TELEMETRY}
SMQ_BOOTSTRAP_INSTANCE_ID: ${SMQ_BOOTSTRAP_INSTANCE_ID}
SMQ_SPICEDB_PRE_SHARED_KEY: ${SMQ_SPICEDB_PRE_SHARED_KEY}
SMQ_SPICEDB_HOST: ${SMQ_SPICEDB_HOST}
SMQ_SPICEDB_PORT: ${SMQ_SPICEDB_PORT}
Expand Down

0 comments on commit c1b5d1a

Please sign in to comment.