Skip to content

Commit

Permalink
Fix readers and writers envars
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Imperiale <manuel.imperiale@gmail.com>
  • Loading branch information
manuio committed Apr 7, 2020
1 parent 134f56b commit e9d2c64
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 91 deletions.
6 changes: 3 additions & 3 deletions cmd/influxdb-reader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
const (
defLogLevel = "error"
defPort = "8180"
defDBName = "messages"
defDB = "messages"
defDBHost = "localhost"
defDBPort = "8086"
defDBUser = "mainflux"
Expand All @@ -45,7 +45,7 @@ const (

envLogLevel = "MF_INFLUX_READER_LOG_LEVEL"
envPort = "MF_INFLUX_READER_PORT"
envDBName = "MF_INFLUX_READER_DB_NAME"
envDB = "MF_INFLUX_READER_DB"
envDBHost = "MF_INFLUX_READER_DB_HOST"
envDBPort = "MF_INFLUX_READER_DB_PORT"
envDBUser = "MF_INFLUX_READER_DB_USER"
Expand Down Expand Up @@ -126,7 +126,7 @@ func loadConfigs() (config, influxdata.HTTPConfig) {
cfg := config{
logLevel: mainflux.Env(envLogLevel, defLogLevel),
port: mainflux.Env(envPort, defPort),
dbName: mainflux.Env(envDBName, defDBName),
dbName: mainflux.Env(envDB, defDB),
dbHost: mainflux.Env(envDBHost, defDBHost),
dbPort: mainflux.Env(envDBPort, defDBPort),
dbUser: mainflux.Env(envDBUser, defDBUser),
Expand Down
6 changes: 3 additions & 3 deletions cmd/influxdb-writer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const (
defNatsURL = "nats://localhost:4222"
defLogLevel = "error"
defPort = "8180"
defDBName = "messages"
defDB = "messages"
defDBHost = "localhost"
defDBPort = "8086"
defDBUser = "mainflux"
Expand All @@ -39,7 +39,7 @@ const (
envNatsURL = "MF_NATS_URL"
envLogLevel = "MF_INFLUX_WRITER_LOG_LEVEL"
envPort = "MF_INFLUX_WRITER_PORT"
envDBName = "MF_INFLUX_WRITER_DB_NAME"
envDB = "MF_INFLUX_WRITER_DB"
envDBHost = "MF_INFLUX_WRITER_DB_HOST"
envDBPort = "MF_INFLUX_WRITER_DB_PORT"
envDBUser = "MF_INFLUX_WRITER_DB_USER"
Expand Down Expand Up @@ -110,7 +110,7 @@ func loadConfigs() (config, influxdata.HTTPConfig) {
natsURL: mainflux.Env(envNatsURL, defNatsURL),
logLevel: mainflux.Env(envLogLevel, defLogLevel),
port: mainflux.Env(envPort, defPort),
dbName: mainflux.Env(envDBName, defDBName),
dbName: mainflux.Env(envDB, defDB),
dbHost: mainflux.Env(envDBHost, defDBHost),
dbPort: mainflux.Env(envDBPort, defDBPort),
dbUser: mainflux.Env(envDBUser, defDBUser),
Expand Down
6 changes: 3 additions & 3 deletions cmd/mongodb-reader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
const (
defLogLevel = "error"
defPort = "8180"
defDBName = "messages"
defDB = "messages"
defDBHost = "localhost"
defDBPort = "27017"
defClientTLS = "false"
Expand All @@ -48,7 +48,7 @@ const (

envLogLevel = "MF_MONGO_READER_LOG_LEVEL"
envPort = "MF_MONGO_READER_PORT"
envDBName = "MF_MONGO_READER_DB_NAME"
envDB = "MF_MONGO_READER_DB"
envDBHost = "MF_MONGO_READER_DB_HOST"
envDBPort = "MF_MONGO_READER_DB_PORT"
envClientTLS = "MF_MONGO_READER_CLIENT_TLS"
Expand Down Expand Up @@ -121,7 +121,7 @@ func loadConfigs() config {
return config{
logLevel: mainflux.Env(envLogLevel, defLogLevel),
port: mainflux.Env(envPort, defPort),
dbName: mainflux.Env(envDBName, defDBName),
dbName: mainflux.Env(envDB, defDB),
dbHost: mainflux.Env(envDBHost, defDBHost),
dbPort: mainflux.Env(envDBPort, defDBPort),
clientTLS: tls,
Expand Down
6 changes: 3 additions & 3 deletions cmd/mongodb-writer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ const (
defLogLevel = "error"
defNatsURL = "nats://localhost:4222"
defPort = "8180"
defDBName = "messages"
defDB = "messages"
defDBHost = "localhost"
defDBPort = "27017"
defSubjectsCfgPath = "/config/subjects.toml"

envNatsURL = "MF_NATS_URL"
envLogLevel = "MF_MONGO_WRITER_LOG_LEVEL"
envPort = "MF_MONGO_WRITER_PORT"
envDBName = "MF_MONGO_WRITER_DB_NAME"
envDB = "MF_MONGO_WRITER_DB"
envDBHost = "MF_MONGO_WRITER_DB_HOST"
envDBPort = "MF_MONGO_WRITER_DB_PORT"
envSubjectsCfgPath = "MF_MONGO_WRITER_SUBJECTS_CONFIG"
Expand Down Expand Up @@ -107,7 +107,7 @@ func loadConfigs() config {
natsURL: mainflux.Env(envNatsURL, defNatsURL),
logLevel: mainflux.Env(envLogLevel, defLogLevel),
port: mainflux.Env(envPort, defPort),
dbName: mainflux.Env(envDBName, defDBName),
dbName: mainflux.Env(envDB, defDB),
dbHost: mainflux.Env(envDBHost, defDBHost),
dbPort: mainflux.Env(envDBPort, defDBPort),
subjectsCfgPath: mainflux.Env(envSubjectsCfgPath, defSubjectsCfgPath),
Expand Down
6 changes: 3 additions & 3 deletions cmd/postgres-reader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (
defDBPort = "5432"
defDBUser = "mainflux"
defDBPass = "mainflux"
defDBName = "messages"
defDB = "messages"
defDBSSLMode = "disable"
defDBSSLCert = ""
defDBSSLKey = ""
Expand All @@ -59,7 +59,7 @@ const (
envDBPort = "MF_POSTGRES_READER_DB_PORT"
envDBUser = "MF_POSTGRES_READER_DB_USER"
envDBPass = "MF_POSTGRES_READER_DB_PASS"
envDBName = "MF_POSTGRES_READER_DB_NAME"
envDB = "MF_POSTGRES_READER_DB"
envDBSSLMode = "MF_POSTGRES_READER_DB_SSL_MODE"
envDBSSLCert = "MF_POSTGRES_READER_DB_SSL_CERT"
envDBSSLKey = "MF_POSTGRES_READER_DB_SSL_KEY"
Expand Down Expand Up @@ -121,7 +121,7 @@ func loadConfig() config {
Port: mainflux.Env(envDBPort, defDBPort),
User: mainflux.Env(envDBUser, defDBUser),
Pass: mainflux.Env(envDBPass, defDBPass),
Name: mainflux.Env(envDBName, defDBName),
Name: mainflux.Env(envDB, defDB),
SSLMode: mainflux.Env(envDBSSLMode, defDBSSLMode),
SSLCert: mainflux.Env(envDBSSLCert, defDBSSLCert),
SSLKey: mainflux.Env(envDBSSLKey, defDBSSLKey),
Expand Down
6 changes: 3 additions & 3 deletions cmd/postgres-writer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const (
defDBPort = "5432"
defDBUser = "mainflux"
defDBPass = "mainflux"
defDBName = "messages"
defDB = "messages"
defDBSSLMode = "disable"
defDBSSLCert = ""
defDBSSLKey = ""
Expand All @@ -48,7 +48,7 @@ const (
envDBPort = "MF_POSTGRES_WRITER_DB_PORT"
envDBUser = "MF_POSTGRES_WRITER_DB_USER"
envDBPass = "MF_POSTGRES_WRITER_DB_PASS"
envDBName = "MF_POSTGRES_WRITER_DB_NAME"
envDB = "MF_POSTGRES_WRITER_DB"
envDBSSLMode = "MF_POSTGRES_WRITER_DB_SSL_MODE"
envDBSSLCert = "MF_POSTGRES_WRITER_DB_SSL_CERT"
envDBSSLKey = "MF_POSTGRES_WRITER_DB_SSL_KEY"
Expand Down Expand Up @@ -108,7 +108,7 @@ func loadConfig() config {
Port: mainflux.Env(envDBPort, defDBPort),
User: mainflux.Env(envDBUser, defDBUser),
Pass: mainflux.Env(envDBPass, defDBPass),
Name: mainflux.Env(envDBName, defDBName),
Name: mainflux.Env(envDB, defDB),
SSLMode: mainflux.Env(envDBSSLMode, defDBSSLMode),
SSLCert: mainflux.Env(envDBSSLCert, defDBSSLCert),
SSLKey: mainflux.Env(envDBSSLKey, defDBSSLKey),
Expand Down
2 changes: 1 addition & 1 deletion docker/addons/influxdb-reader/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
environment:
MF_INFLUX_READER_LOG_LEVEL: debug
MF_INFLUX_READER_PORT: ${MF_INFLUX_READER_PORT}
MF_INFLUX_READER_DB_NAME: ${MF_INFLUX_READER_DB_NAME}
MF_INFLUX_READER_DB: ${MF_INFLUX_READER_DB}
MF_INFLUX_READER_DB_HOST: mainflux-influxdb
MF_INFLUX_READER_DB_PORT: ${MF_INFLUX_READER_DB_PORT}
MF_INFLUX_READER_DB_USER: ${MF_INFLUX_READER_DB_USER}
Expand Down
4 changes: 2 additions & 2 deletions docker/addons/influxdb-writer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
container_name: mainflux-influxdb
restart: on-failure
environment:
INFLUXDB_DB: ${MF_INFLUX_WRITER_DB_NAME}
INFLUXDB_DB: ${MF_INFLUX_WRITER_DB}
INFLUXDB_ADMIN_USER: ${MF_INFLUX_WRITER_DB_USER}
INFLUXDB_ADMIN_PASSWORD: ${MF_INFLUX_WRITER_DB_PASS}
networks:
Expand All @@ -44,7 +44,7 @@ services:
MF_INFLUX_WRITER_PORT: ${MF_INFLUX_WRITER_PORT}
MF_INFLUX_WRITER_BATCH_SIZE: ${MF_INFLUX_WRITER_BATCH_SIZE}
MF_INFLUX_WRITER_BATCH_TIMEOUT: ${MF_INFLUX_WRITER_BATCH_TIMEOUT}
MF_INFLUX_WRITER_DB_NAME: ${MF_INFLUX_WRITER_DB_NAME}
MF_INFLUX_WRITER_DB: ${MF_INFLUX_WRITER_DB}
MF_INFLUX_WRITER_DB_HOST: mainflux-influxdb
MF_INFLUX_WRITER_DB_PORT: ${MF_INFLUX_WRITER_DB_PORT}
MF_INFLUX_WRITER_DB_USER: ${MF_INFLUX_WRITER_DB_USER}
Expand Down
2 changes: 1 addition & 1 deletion docker/addons/mongodb-reader/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
environment:
MF_MONGO_READER_LOG_LEVEL: ${MF_MONGO_READER_LOG_LEVEL}
MF_MONGO_READER_PORT: ${MF_MONGO_READER_PORT}
MF_MONGO_READER_DB_NAME: ${MF_MONGO_READER_DB_NAME}
MF_MONGO_READER_DB: ${MF_MONGO_READER_DB}
MF_MONGO_READER_DB_HOST: mongodb
MF_MONGO_READER_DB_PORT: ${MF_MONGO_READER_DB_PORT}
MF_MONGO_READER_SERVER_CERT: ${MF_MONGO_READER_SERVER_CERT}
Expand Down
4 changes: 2 additions & 2 deletions docker/addons/mongodb-writer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
container_name: mainflux-mongodb
restart: on-failure
environment:
MONGO_INITDB_DATABASE: ${MF_MONGO_WRITER_DB_NAME}
MONGO_INITDB_DATABASE: ${MF_MONGO_WRITER_DB}
ports:
- ${MF_MONGO_WRITER_DB_PORT}:${MF_MONGO_WRITER_DB_PORT}
networks:
Expand All @@ -43,7 +43,7 @@ services:
MF_MONGO_WRITER_LOG_LEVEL: ${MF_MONGO_WRITER_LOG_LEVEL}
MF_NATS_URL: ${MF_NATS_URL}
MF_MONGO_WRITER_PORT: ${MF_MONGO_WRITER_PORT}
MF_MONGO_WRITER_DB_NAME: ${MF_MONGO_WRITER_DB_NAME}
MF_MONGO_WRITER_DB: ${MF_MONGO_WRITER_DB}
MF_MONGO_WRITER_DB_HOST: mongodb
MF_MONGO_WRITER_DB_PORT: ${MF_MONGO_WRITER_DB_PORT}
ports:
Expand Down
2 changes: 1 addition & 1 deletion docker/addons/postgres-reader/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ services:
MF_POSTGRES_READER_DB_PORT: ${MF_POSTGRES_READER_DB_PORT}
MF_POSTGRES_READER_DB_USER: ${MF_POSTGRES_READER_DB_USER}
MF_POSTGRES_READER_DB_PASS: ${MF_POSTGRES_READER_DB_PASS}
MF_POSTGRES_READER_DB_NAME: ${MF_POSTGRES_READER_DB_NAME}
MF_POSTGRES_READER_DB: ${MF_POSTGRES_READER_DB}
MF_POSTGRES_READER_DB_SSL_MODE: ${MF_POSTGRES_READER_DB_SSL_MODE}
MF_POSTGRES_READER_DB_SSL_CERT: ${MF_POSTGRES_READER_DB_SSL_CERT}
MF_POSTGRES_READER_DB_SSL_KEY: ${MF_POSTGRES_READER_DB_SSL_KEY}
Expand Down
4 changes: 2 additions & 2 deletions docker/addons/postgres-writer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:
environment:
POSTGRES_USER: ${MF_POSTGRES_WRITER_DB_USER}
POSTGRES_PASSWORD: ${MF_POSTGRES_WRITER_DB_PASS}
POSTGRES_DB: ${MF_POSTGRES_WRITER_DB_NAME}
POSTGRES_DB: ${MF_POSTGRES_WRITER_DB}
networks:
- docker_mainflux-base-net
volumes:
Expand All @@ -45,7 +45,7 @@ services:
MF_POSTGRES_WRITER_DB_PORT: ${MF_POSTGRES_WRITER_DB_PORT}
MF_POSTGRES_WRITER_DB_USER: ${MF_POSTGRES_WRITER_DB_USER}
MF_POSTGRES_WRITER_DB_PASS: ${MF_POSTGRES_WRITER_DB_PASS}
MF_POSTGRES_WRITER_DB_NAME: ${MF_POSTGRES_WRITER_DB_NAME}
MF_POSTGRES_WRITER_DB: ${MF_POSTGRES_WRITER_DB}
MF_POSTGRES_WRITER_DB_SSL_MODE: ${MF_POSTGRES_WRITER_DB_SSL_MODE}
MF_POSTGRES_WRITER_DB_SSL_CERT: ${MF_POSTGRES_WRITER_DB_SSL_CERT}
MF_POSTGRES_WRITER_DB_SSL_KEY: ${MF_POSTGRES_WRITER_DB_SSL_KEY}
Expand Down
34 changes: 17 additions & 17 deletions readers/influxdb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ The service is configured using the environment variables presented in the
following table. Note that any unset variables will be replaced with their
default values.

| Variable | Description | Default |
|---------------------------------|-----------------------------------------------------|----------------|
| MF_INFLUX_READER_PORT | Service HTTP port | 8180 |
| MF_INFLUX_READER_DB_HOST | InfluxDB host | localhost |
| MF_INFLUX_READER_DB_PORT | Default port of InfluxDB database | 8086 |
| MF_INFLUX_READER_DB_USER | Default user of InfluxDB database | mainflux |
| MF_INFLUX_READER_DB_PASS | Default password of InfluxDB user | mainflux |
| MF_INFLUX_READER_DB_NAME | InfluxDB database name | messages |
| MF_INFLUX_READER_CLIENT_TLS | Flag that indicates if TLS should be turned on | false |
| MF_INFLUX_READER_CA_CERTS | Path to trusted CAs in PEM format | |
| MF_INFLUX_READER_SERVER_CERT | Path to server certificate in pem format | |
| MF_INFLUX_READER_SERVER_KEY | Path to server key in pem format | |
| MF_JAEGER_URL | Jaeger server URL | localhost:6831 |
| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:8181 |
| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1 |
| Variable | Description | Default |
|------------------------------|-----------------------------------------------------|----------------|
| MF_INFLUX_READER_PORT | Service HTTP port | 8180 |
| MF_INFLUX_READER_DB_HOST | InfluxDB host | localhost |
| MF_INFLUX_READER_DB_PORT | Default port of InfluxDB database | 8086 |
| MF_INFLUX_READER_DB_USER | Default user of InfluxDB database | mainflux |
| MF_INFLUX_READER_DB_PASS | Default password of InfluxDB user | mainflux |
| MF_INFLUX_READER_DB | InfluxDB database name | messages |
| MF_INFLUX_READER_CLIENT_TLS | Flag that indicates if TLS should be turned on | false |
| MF_INFLUX_READER_CA_CERTS | Path to trusted CAs in PEM format | |
| MF_INFLUX_READER_SERVER_CERT | Path to server certificate in pem format | |
| MF_INFLUX_READER_SERVER_KEY | Path to server key in pem format | |
| MF_JAEGER_URL | Jaeger server URL | localhost:6831 |
| MF_THINGS_AUTH_GRPC_URL | Things service Auth gRPC URL | localhost:8181 |
| MF_THINGS_AUTH_GRPC_TIMEOUT | Things service Auth gRPC request timeout in seconds | 1 |

## Deployment

Expand All @@ -34,7 +34,7 @@ default values.
restart: on-failure
environment:
MF_INFLUX_READER_PORT: [Service HTTP port]
MF_INFLUX_READER_DB_NAME: [InfluxDB name]
MF_INFLUX_READER_DB: [InfluxDB name]
MF_INFLUX_READER_DB_HOST: [InfluxDB host]
MF_INFLUX_READER_DB_PORT: [InfluxDB port]
MF_INFLUX_READER_DB_USER: [InfluxDB admin user]
Expand Down Expand Up @@ -66,7 +66,7 @@ make install

# Set the environment variables and run the service
MF_INFLUX_READER_PORT=[Service HTTP port] \
MF_INFLUX_READER_DB_NAME=[InfluxDB database name] \
MF_INFLUX_READER_DB=[InfluxDB database name] \
MF_INFLUX_READER_DB_HOST=[InfluxDB database host] \
MF_INFLUX_READER_DB_PORT=[InfluxDB database port] \
MF_INFLUX_READER_DB_USER=[InfluxDB admin user] \
Expand Down
6 changes: 3 additions & 3 deletions readers/mongodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ default values.
| Variable | Description | Default |
|-----------------------------|-----------------------------------------------------|----------------|
| MF_MONGO_READER_PORT | Service HTTP port | 8180 |
| MF_MONGO_READER_DB_NAME | MongoDB database name | messages |
| MF_MONGO_READER_DB | MongoDB database name | messages |
| MF_MONGO_READER_DB_HOST | MongoDB database host | localhost |
| MF_MONGO_READER_DB_PORT | MongoDB database port | 27017 |
| MF_MONGO_READER_CLIENT_TLS | Flag that indicates if TLS should be turned on | false |
Expand All @@ -34,7 +34,7 @@ default values.
restart: on-failure
environment:
MF_MONGO_READER_PORT: [Service HTTP port]
MF_MONGO_READER_DB_NAME: [MongoDB name]
MF_MONGO_READER_DB: [MongoDB name]
MF_MONGO_READER_DB_HOST: [MongoDB host]
MF_MONGO_READER_DB_PORT: [MongoDB port]
MF_MONGO_READER_CLIENT_TLS: [Flag that indicates if TLS should be turned on]
Expand Down Expand Up @@ -64,7 +64,7 @@ make install

# Set the environment variables and run the service
MF_MONGO_READER_PORT=[Service HTTP port] \
MF_MONGO_READER_DB_NAME=[MongoDB database name] \
MF_MONGO_READER_DB=[MongoDB database name] \
MF_MONGO_READER_DB_HOST=[MongoDB database host] \
MF_MONGO_READER_DB_PORT=[MongoDB database port] \
MF_MONGO_READER_CLIENT_TLS=[Flag that indicates if TLS should be turned on] \
Expand Down
6 changes: 3 additions & 3 deletions readers/postgres/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ default values.
| MF_POSTGRES_READER_DB_PORT | Postgres DB port | 5432 |
| MF_POSTGRES_READER_DB_USER | Postgres user | mainflux |
| MF_POSTGRES_READER_DB_PASS | Postgres password | mainflux |
| MF_POSTGRES_READER_DB_NAME | Postgres database name | messages |
| MF_POSTGRES_READER_DB | Postgres database name | messages |
| MF_POSTGRES_READER_DB_SSL_MODE | Postgres SSL mode | disabled |
| MF_POSTGRES_READER_DB_SSL_CERT | Postgres SSL certificate path | "" |
| MF_POSTGRES_READER_DB_SSL_KEY | Postgres SSL key | "" |
Expand Down Expand Up @@ -46,7 +46,7 @@ default values.
MF_POSTGRES_READER_DB_PORT: [Postgres port]
MF_POSTGRES_READER_DB_USER: [Postgres user]
MF_POSTGRES_READER_DB_PASS: [Postgres password]
MF_POSTGRES_READER_DB_NAME: [Postgres database name]
MF_POSTGRES_READER_DB: [Postgres database name]
MF_POSTGRES_READER_DB_SSL_MODE: [Postgres SSL mode]
MF_POSTGRES_READER_DB_SSL_CERT: [Postgres SSL cert]
MF_POSTGRES_READER_DB_SSL_KEY: [Postgres SSL key]
Expand Down Expand Up @@ -83,7 +83,7 @@ MF_POSTGRES_READER_DB_HOST=[Postgres host] \
MF_POSTGRES_READER_DB_PORT=[Postgres port] \
MF_POSTGRES_READER_DB_USER=[Postgres user] \
MF_POSTGRES_READER_DB_PASS=[Postgres password] \
MF_POSTGRES_READER_DB_NAME=[Postgres database name] \
MF_POSTGRES_READER_DB=[Postgres database name] \
MF_POSTGRES_READER_DB_SSL_MODE=[Postgres SSL mode] \
MF_POSTGRES_READER_DB_SSL_CERT=[Postgres SSL cert] \
MF_POSTGRES_READER_DB_SSL_KEY=[Postgres SSL key] \
Expand Down
Loading

0 comments on commit e9d2c64

Please sign in to comment.