Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate yaml config for sydent #388

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cf17843
Add SydentConfig class and use when calling Sydent constructor
Sep 7, 2021
2985b37
Move database config handling over to SydentConfig
Sep 7, 2021
3a1a400
Move crypto config handling over to SydentConfig
Sep 7, 2021
91fdc6b
Move sms config handling over to SydentConfig
Sep 7, 2021
4b0a900
Move deprecated email template config over to SydentConfig
Sep 7, 2021
21b030a
Move email config handled by synapse.py over to SynapseConfig
Sep 7, 2021
11f8711
Move rest of email config over to SydenConfig
Sep 7, 2021
f09779b
Move deprecated http template config over to SydentConfig
Sep 7, 2021
25aac48
Move rest of http config handling over to SynapseConfig
Sep 7, 2021
1492c1c
Move server name config handling to SydentConfig
Sep 7, 2021
bb02656
Move 'general' template config handling over to SydentConfig
Sep 7, 2021
2d460ee
Move rest of 'general' config handling over to SydentConfig
Sep 7, 2021
4b0eb67
Remove deprecated template argument from get_branded_template
Sep 8, 2021
37b928b
Remove old cfg argument from Sydent constructor
Sep 8, 2021
a9415f4
Add changelog
Sep 8, 2021
63580f8
Add generate_config and generate_sample_config scripts
Sep 8, 2021
6597a0f
Add generate config to crypto.py
Sep 8, 2021
8f5f71f
Add generate config to database.py
Sep 8, 2021
a8d5c8f
Add generate config to email.py
Sep 8, 2021
37e027d
Add generate config to sms.py
Sep 8, 2021
35874de
Add generate config to http.py
Sep 9, 2021
8987f4c
Add generate config to general.py
Sep 9, 2021
b50a59d
Generate sample config and create github job to check it
Sep 9, 2021
460c269
Add changelog
Sep 9, 2021
30ac8d2
Add migration guide from old config to new config
Sep 9, 2021
dccf0f8
Remove ... between param and return in docstrings
Sep 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/changelog_check copy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Sample Config
on: [pull_request]

jobs:
check-sample_config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.7"
- run: python -m pip install .
- run: scripts/generate_sample_config --check
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ _trial_temp.lock

# Runtime files
/sydent.conf
/sydent.yaml
/sydent.db
/sydent.pid
/matrix_is_test/sydent.stderr
1 change: 1 addition & 0 deletions changelog.d/385.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move the configuration file handling code into a seperate module.
1 change: 1 addition & 0 deletions changelog.d/388.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ability to generate YAML config file.
144 changes: 144 additions & 0 deletions docs/migrating_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Migrating from old-style config to YAML-style config

# In this document, the line 'aaaaa: bbb.ccc.ddd' means
# "To configure things as they were before, substitute
# 'bbb.ccc.ddd' with the value set for bbb.ccc.ddd in the
# old config"

# Some config options no longer exist:
#
# * Three templating options:
# - email.invite_template
# - email.template
# - verify_response_template
#
# To migrate these settings, create the following file structure somewhere:
#
# root_template_dir:
# default:
# invite_template.eml
# (the file that 'email.invite_template' pointed to)
# verification_template.eml
# (the file that 'email.template' pointed to)
# verify_response_template.html
# (the file that 'verify_response_template' pointed to)
#
# Then set 'templates.root_directory' to the path of 'root_template_dir'
# and 'templates.default_brand' to 'default'
#
# * email.subject
# - Removed because it doesn't get used anywhere in the code
# - If it was added in the future it would be 'email.contents.validation_subject'

## General ##
server_name: server.name

logging:
log_path: log.path
log_level: log.level

pid_file: pidfile.path

terms_file: terms.path

address_lookup_limit: address_lookup_limit

enable_v1_associations: enable_v1_associations

delete_tokens_on_bind: delete_tokens_on_bind

templates:
root_directory: templates.path
default_brand: brand.default

prometheus:
enabled: [prometheus_port is present]
bind_address: prometheus_addr
port: prometheus_port

sentry:
enabled: [sentry_dsn is present]
dsn: sentry_dsn

ip_filtering:
blacklist:
- AAAAAA -|
- BBBBBB |- values in ip.blacklist list
- CCCCCC -|
whitelist:
- AAAAAA -|
- BBBBBB |- values in ip.whitelist list
- CCCCCC -|

## Database ##
database_path: db.file

## Crypto ##
ed25519_signing_key: ed25519.signingkey

## SMS ##
sms:
SMS_template: bodytemplate

openmarket_SMS_API:
username: username
password: password

sms_originator:
country_code:
- 1:
- AAAAAA -|
- BBBBBB |- values in originators.1 list
- CCCCCC -|
- 44:
- AAAAAA -|
- BBBBBB |- values in originators.44 list
- CCCCCC -|
default: originators.default

country_code_blacklist:
- 44 [smsrule.44 = reject]
- 33 [smsrule.33 = reject]
- 276 [smsrule.276 = reject]

## Emails ##
email:
SMTP:
server: email.smtphost
port: email.smtpport
username: email.smtpusername
password: email.smtppassword
tls_mode: email.tlsmode
host_name: email.hostname

contents:
sender: email.from
room_invite_subject: email.invite.subject
space_invite_subject: email.invite.subject_space
default_matrix_client: email.default_web_client_location
obfuscation_amounts:
username: email.third_party_invite_username_obfuscate_characters
domain: email.third_party_invite_domain_obfuscate_characters

## HTTP ##
server_base_url: client_http_base

http_servers:
client_api:
bind_address: clientapi.http.bind_address
port: clientapi.http.port

replication_api:
bind_address: replication.https.bind_address
port: replication.https.port
cert_file: replication.https.certfile
ca_cert: replication.https.cacert

internal_api:
enabled: [internalapi.http.port is not empty string]
bind_address: internalapi.http.bind_address
port: internalapi.http.port

obey_x_forwarded_for: obey_x_forwarded_for

verify_homeserver_certs: federation.verifycerts
Loading