Skip to main content

Configs and secrets πŸͺ

info

Some old/legacy services use environment variables for they own configuration, but It be good tone to refactor that.

Config​

Yalm file located in standart path:

/service_path/config.yaml
config:
common:
service_name: auth
environment: dev / stage / prod
environment_name: dev01 / stage / prod
social:
callback_url: http://callback1
# ...
kafka:
brokers: ["kafka-headless.kafka:9092"]
topic_name: "player.favorite_games.change"
schema_registry: "http://kafka-rest-cp-schema-registry.kafka:8081"
logstash:
host: logstash.n0d.io
port: 1220
env: someenv
sentry:
dsn: ""
services:
auth:
- http: 3000
- gprc: 9090
signup:
...

brands:
vostok:
social:
callback_url: http://callback2
networks:
facebook:
...

Secrets​

Described under Infrastructure -> Configurations and Secrets

Environments​

All configurations happen through configuration management. We don't use environment variables for application configuration.

caution

Try don't use environment variables on environments when not really necessary.

Default environments:
ENVIRONMENT: dev
ENVIRONMENT_NAME: dev01
SERVICE_NAME: places
SERVICE_VERSION: v0.0.1-master

Permissions​

Example
permissions:
player:
all: 'player.*'
profile: 'player.profile.*'

Hot reloading​

Config layers:​

  • brand ↓
  • application ↓
  • infrastructure ↓

Application layer will override infrastructure. Brand used only manualy in business logic.

Config example
# brand
config: # type
common: # application layer
testVar: 1
brand: # brand layer
testVar: 2

secrets: # type
common: # application layer
testVar: 3

# Merge vector: secrets.common -> config.common

Config type:​

  • secret ↓
  • config ↓

Service dependencies πŸ‘Ύβ€‹

dependencies.yml needed to say out infrastructure what that service need for working.

Form that file we can generate heml charts and give access to that services.

--- 
dependencies:
mariadb: [self, service_name]
kafka: [self]
redis: [self, service_name]