Configuration format v1 (#1230)

* Initial pass at refactoring config (not finished)

* Don't forget current state and EDU servers

* More shifting around

* Update server key API tests

* Fix roomserver test

* Fix more tests

* Further tweaks

* Fix current state server test (sort of)

* Maybe fix appservices

* Fix client API test

* Include database connection string in database options

* Fix sync API build

* Update config test

* Fix unit tests

* Fix federation sender build

* Fix gobind build

* Set Listen address for all services in HTTP monolith mode

* Validate config, reinstate appservice derived in directory, tweaks

* Tweak federation API test

* Set MaxOpenConnections/MaxIdleConnections to previous values

* Update generate-config
This commit is contained in:
Neil Alexander 2020-08-10 14:18:04 +01:00 committed by GitHub
parent fdabba1851
commit 4b09f445c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
155 changed files with 1716 additions and 1503 deletions

View file

@ -33,48 +33,157 @@ func TestLoadConfigRelative(t *testing.T) {
}
const testConfig = `
version: 0
matrix:
version: 1
global:
server_name: localhost
private_key: matrix_key.pem
federation_certificates: [tls_cert.pem]
media:
base_path: media_store
kafka:
addresses: ["localhost:9092"]
topics:
output_room_event: output.room
output_client_data: output.client
output_typing_event: output.typing
output_send_to_device_event: output.std
output_key_change_event: output.key_change
user_updates: output.user
database:
media_api: "postgresql:///media_api"
account: "postgresql:///account"
device: "postgresql:///device"
server_key: "postgresql:///server_keys"
sync_api: "postgresql:///syn_api"
room_server: "postgresql:///room_server"
appservice: "postgresql:///appservice"
current_state: "postgresql:///current_state"
e2e_key: "postgresql:///e2e_key"
listen:
room_server: "localhost:7770"
client_api: "localhost:7771"
federation_api: "localhost:7772"
sync_api: "localhost:7773"
media_api: "localhost:7774"
appservice_api: "localhost:7777"
edu_server: "localhost:7778"
user_api: "localhost:7779"
current_state_server: "localhost:7775"
key_server: "localhost:7776"
logging:
- type: "file"
level: "info"
params:
path: "/my/log/dir"
key_validity_period: 168h0m0s
trusted_third_party_id_servers: []
kafka:
addresses: []
use_naffka: true
naffka_database:
connection_string: file:naffka.db
max_open_conns: 0
max_idle_conns: 0
conn_max_lifetime: -1
topics:
output_room_event: OutputRoomEventTopic
output_client_data: OutputClientDataTopic
output_typing_event: OutputTypingEventTopic
output_send_to_device_event: OutputSendToDeviceEventTopic
output_key_change_event: OutputKeyChangeEventTopic
metrics:
enabled: false
basic_auth:
username: metrics
password: metrics
app_service_api:
listen: localhost:7777
bind: localhost:7777
database:
connection_string: file:appservice.db
max_open_conns: 0
max_idle_conns: 0
conn_max_lifetime: -1
config_files: []
client_api:
listen: localhost:7771
bind: localhost:7771
registration_shared_secret: ""
recaptcha_public_key: ""
recaptcha_private_key: ""
enable_registration_captcha: false
captcha_bypass_secret: ""
recaptcha_siteverify_api: ""
registration_disabled: false
turn:
turn_user_lifetime: ""
turn_uris: []
turn_shared_secret: ""
turn_username: ""
turn_password: ""
current_state_server:
listen: localhost:7782
bind: localhost:7782
database:
connection_string: file:currentstate.db
max_open_conns: 0
max_idle_conns: 0
conn_max_lifetime: -1
edu_server:
listen: localhost:7778
bind: localhost:7778
federation_api:
listen: localhost:7772
bind: localhost:7772
federation_certificates: []
federation_sender:
listen: localhost:7775
bind: localhost:7775
database:
connection_string: file:federationsender.db
max_open_conns: 0
max_idle_conns: 0
conn_max_lifetime: -1
federation_max_retries: 16
proxy_outbound:
enabled: false
protocol: http
host: localhost
port: 8080
key_server:
listen: localhost:7779
bind: localhost:7779
database:
connection_string: file:keyserver.db
max_open_conns: 0
max_idle_conns: 0
conn_max_lifetime: -1
media_api:
listen: localhost:7774
bind: localhost:7774
database:
connection_string: file:mediaapi.db
max_open_conns: 0
max_idle_conns: 0
conn_max_lifetime: -1
base_path: ""
max_file_size_bytes: 10485760
dynamic_thumbnails: false
max_thumbnail_generators: 10
thumbnail_sizes: []
room_server:
listen: localhost:7770
bind: localhost:7770
database:
connection_string: file:roomserver.db
max_open_conns: 0
max_idle_conns: 0
conn_max_lifetime: -1
server_key_api:
listen: localhost:7780
bind: localhost:7780
database:
connection_string: file:serverkeyapi.db
max_open_conns: 0
max_idle_conns: 0
conn_max_lifetime: -1
key_perspectives: []
sync_api:
listen: localhost:7773
bind: localhost:7773
database:
connection_string: file:syncapi.db
max_open_conns: 0
max_idle_conns: 0
conn_max_lifetime: -1
user_api:
listen: localhost:7781
bind: localhost:7781
account_database:
connection_string: file:userapi_accounts.db
max_open_conns: 0
max_idle_conns: 0
conn_max_lifetime: -1
device_database:
connection_string: file:userapi_devices.db
max_open_conns: 0
max_idle_conns: 0
conn_max_lifetime: -1
tracing:
enabled: false
jaeger:
serviceName: ""
disabled: false
rpc_metrics: false
tags: []
sampler: null
reporter: null
headers: null
baggage_restrictions: null
throttler: null
logging: []
`
type mockReadFile map[string]string