Skip to content

Commit 0dd0b3a

Browse files
committed
feat: Add ENV variable support for buggregator server configuration
1 parent 76290b2 commit 0dd0b3a

File tree

4 files changed

+47
-28
lines changed

4 files changed

+47
-28
lines changed

Diff for: .rr-prod.yaml

+43-10
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,42 @@ server:
1313
command: "php app.php register:modules"
1414

1515
logs:
16-
level: ${RR_LOG_LEVEL:-info}
16+
# Logging mode can be "development", "production" or "raw".
17+
# Do not forget to change this value for production environment.
18+
mode: ${RR_LOG_MODE:-production}
19+
# Encoding format can be "console" or "json" (last is preferred for production usage).
20+
encoding: ${RR_LOG_ENCODING:-json}
21+
# Logging level can be "panic", "error", "warn", "info", "debug".
22+
level: ${RR_LOG_LEVEL:-warn}
23+
channels:
24+
http:
25+
# HTTP plugin logging level can be "panic", "error", "warn", "info", "debug".
26+
level: ${RR_LOG_HTTP_LEVEL:-warn}
27+
tcp:
28+
# TCP plugin logging level can be "panic", "error", "warn", "info", "debug".
29+
level: ${RR_LOG_TCP_LEVEL:-warn}
30+
jobs:
31+
# JOBS plugin logging level can be "panic", "error", "warn", "info", "debug".
32+
level: ${RR_LOG_TCP_LEVEL:-warn}
33+
centrifuge:
34+
# Centrifuge plugin logging level can be "panic", "error", "warn", "info", "debug".
35+
level: ${RR_LOG_CENTRIFUGE_LEVEL:-warn}
36+
server:
37+
# Server logging level can be "panic", "error", "warn", "info", "debug".
38+
level: ${RR_LOG_SERVER_LEVEL:-warn}
39+
service:
40+
# Service logging level can be "panic", "error", "warn", "info", "debug".
41+
level: ${RR_LOG_SERVICE_LEVEL:-warn}
1742

1843
http:
1944
address: 127.0.0.1:8082
2045
middleware: [ "headers" ]
2146
headers:
2247
cors:
23-
allowed_origin: "*"
24-
allowed_headers: "*"
48+
allowed_origin: ${RR_HTTP_ALLOWED_ORIGIN:-*}
49+
allowed_headers: ${RR_HTTP_ALLOWED_HEADERS:-*}
2550
allowed_methods: "GET,POST,PUT,DELETE"
26-
allow_credentials: true
51+
allow_credentials: ${RR_HTTP_ALLOW_CREDENTIALS:-true}
2752
exposed_headers: "Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma"
2853
max_age: 600
2954
pool:
@@ -32,13 +57,21 @@ http:
3257
tcp:
3358
servers:
3459
monolog:
35-
addr: :9913
60+
# Address to listen.
61+
addr: ${RR_TCP_MONOLOG_ADDR:-:9913}
3662
delimiter: "\n"
3763
var-dumper:
38-
addr: :9912
64+
# Address to listen.
65+
addr: ${RR_TCP_VAR_DUMPER_ADDR:-:9912}
3966
delimiter: "\n"
4067
smtp:
41-
addr: :1025
68+
# Address to listen.
69+
addr: ${RR_TCP_SMTP_ADDR:-:1025}
70+
# Chunks that RR uses to read the data. In bytes.
71+
# If you expect big payloads on a TCP server, to reduce `read` syscalls,
72+
# would be a good practice to use a fairly big enough buffer.
73+
# Default: 1024 * 1024 * 50 (50MB)
74+
read_buf_size: ${RR_TCP_READ_BUF_SIZE:-50485760}
4275
pool:
4376
num_workers: ${RR_TCP_NUM_WORKERS}
4477

@@ -54,17 +87,17 @@ service:
5487
nginx:
5588
service_name_in_log: true
5689
remain_after_exit: true
57-
restart_sec: 1
90+
restart_sec: 5
5891
command: "/usr/sbin/nginx"
5992
centrifuge:
6093
service_name_in_log: true
6194
remain_after_exit: true
62-
restart_sec: 1
95+
restart_sec: 5
6396
command: "./bin/centrifugo --config=centrifugo.json"
6497
dolt:
6598
service_name_in_log: true
6699
remain_after_exit: true
67-
restart_sec: 1
100+
restart_sec: 5
68101
command: "./bin/dolt sql-server --data-dir=.db"
69102

70103
centrifuge:

Diff for: .rr.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ service:
5252
centrifuge:
5353
service_name_in_log: true
5454
remain_after_exit: true
55-
restart_sec: 1
55+
restart_sec: 5
5656
command: "./bin/centrifugo --config=centrifugo.json"
5757
dolt:
5858
service_name_in_log: true
5959
remain_after_exit: true
60-
restart_sec: 1
60+
restart_sec: 5
6161
command: "./bin/dolt sql-server --data-dir=.db"
6262

6363
centrifuge:

Diff for: app/config/database.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
),
5656

5757
// Only for testing purposes
58-
// SQLite does not support multiple connections in the same time
58+
// SQLite does not support multiple connections simultaneously
5959
'sqlite' => new SQLiteDriverConfig(
6060
connection: new FileConnectionConfig(database: directory('runtime') . 'test.db'),
6161
options: [

Diff for: docker-compose.yaml

+1-15
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ services:
4040
DB_DRIVER: pgsql
4141
DB_HOST: buggregator-pgsql
4242

43-
# PERSISTENCE_DRIVER: mongodb
44-
MONGODB_CONNECTION: mongodb://homestead:secret@buggregator-mongo:27017
45-
MONGODB_DATABASE: buggregator
46-
4743
# Auth
4844
AUTH_ENABLED: false
4945
AUTH_PROVIDER_URL: https://${AUTH_DOMAIN}.us.auth0.com
@@ -63,17 +59,7 @@ services:
6359
- ./app:/app/app
6460
- ./runtime:/app/runtime
6561
- ./vendor:/app/vendor
66-
networks:
67-
- buggregator-network
68-
69-
buggregator-mongo:
70-
image: mongo:latest
71-
environment:
72-
MONGO_INITDB_ROOT_USERNAME: homestead
73-
MONGO_INITDB_ROOT_PASSWORD: secret
74-
MONGO_INITDB_DATABASE: buggregator
75-
ports:
76-
- 27017:27017
62+
- ./.rr-prod.yaml:/app/.rr-prod.yaml
7763
networks:
7864
- buggregator-network
7965

0 commit comments

Comments
 (0)