From c1b5d1a85388f82843dc7fde0b3a2ea6829b1800 Mon Sep 17 00:00:00 2001 From: Felix Gateru Date: Thu, 9 Jan 2025 09:19:00 +0300 Subject: [PATCH] refactor: rename env variables Signed-off-by: Felix Gateru --- cmd/bootstrap/main.go | 30 ++++----- docker/.env | 76 +++++++++++----------- docker/addons/bootstrap/docker-compose.yml | 42 ++++++------ 3 files changed, 74 insertions(+), 74 deletions(-) diff --git a/cmd/bootstrap/main.go b/cmd/bootstrap/main.go index 08e59405b..59465ca02 100644 --- a/cmd/bootstrap/main.go +++ b/cmd/bootstrap/main.go @@ -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" @@ -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() { diff --git a/docker/.env b/docker/.env index 2520a5b6d..f42a072ec 100644 --- a/docker/.env +++ b/docker/.env @@ -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 diff --git a/docker/addons/bootstrap/docker-compose.yml b/docker/addons/bootstrap/docker-compose.yml index 393d7f5ee..381d56a04 100644 --- a/docker/addons/bootstrap/docker-compose.yml +++ b/docker/addons/bootstrap/docker-compose.yml @@ -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: @@ -33,25 +33,26 @@ services: - bootstrap-db restart: on-failure ports: - - ${SMQ_BOOTSTRAP_HTTP_PORT}:${SMQ_BOOTSTRAP_HTTP_PORT} + - ${MG_BOOTSTRAP_HTTP_PORT}:${MG_BOOTSTRAP_HTTP_PORT} environment: - SMQ_BOOTSTRAP_LOG_LEVEL: ${SMQ_BOOTSTRAP_LOG_LEVEL} - SMQ_BOOTSTRAP_ENCRYPT_KEY: ${SMQ_BOOTSTRAP_ENCRYPT_KEY} - SMQ_BOOTSTRAP_EVENT_CONSUMER: ${SMQ_BOOTSTRAP_EVENT_CONSUMER} + MG_BOOTSTRAP_LOG_LEVEL: ${MG_BOOTSTRAP_LOG_LEVEL} + MG_BOOTSTRAP_ENCRYPT_KEY: ${MG_BOOTSTRAP_ENCRYPT_KEY} + MG_BOOTSTRAP_EVENT_CONSUMER: ${MG_BOOTSTRAP_EVENT_CONSUMER} SMQ_ES_URL: ${SMQ_ES_URL} - SMQ_BOOTSTRAP_HTTP_HOST: ${SMQ_BOOTSTRAP_HTTP_HOST} - SMQ_BOOTSTRAP_HTTP_PORT: ${SMQ_BOOTSTRAP_HTTP_PORT} - SMQ_BOOTSTRAP_HTTP_SERVER_CERT: ${SMQ_BOOTSTRAP_HTTP_SERVER_CERT} - SMQ_BOOTSTRAP_HTTP_SERVER_KEY: ${SMQ_BOOTSTRAP_HTTP_SERVER_KEY} - SMQ_BOOTSTRAP_DB_HOST: ${SMQ_BOOTSTRAP_DB_HOST} - SMQ_BOOTSTRAP_DB_PORT: ${SMQ_BOOTSTRAP_DB_PORT} - SMQ_BOOTSTRAP_DB_USER: ${SMQ_BOOTSTRAP_DB_USER} - SMQ_BOOTSTRA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GRPC_URL} SMQ_AUTH_GRPC_TIMEOUT: ${SMQ_AUTH_GRPC_TIMEOUT} SMQ_AUTH_GRPC_CLIENT_CERT: ${SMQ_AUTH_GRPC_CLIENT_CERT:+/auth-grpc-client.crt} @@ -67,7 +68,6 @@ services: 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}