This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a script to generate a clean config file
Ultimately I want to make this part of the debian packaging process, to stop the debian config getting out of sync.
- Loading branch information
Showing
11 changed files
with
157 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add a script to generate a clean config file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse | ||
import sys | ||
|
||
from synapse.config.homeserver import HomeServerConfig | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"--config-dir", | ||
default="CONFDIR", | ||
|
||
help="The path where the config files are kept. Used to create filenames for " | ||
"things like the log config and the signing key. Default: %(default)s", | ||
) | ||
|
||
parser.add_argument( | ||
"--data-dir", | ||
default="DATADIR", | ||
help="The path where the data files are kept. Used to create filenames for " | ||
"things like the database and media store. Default: %(default)s", | ||
) | ||
|
||
parser.add_argument( | ||
"--server-name", | ||
default="SERVERNAME", | ||
help="The server name. Used to initialise the server_name config param, but also " | ||
"used in the names of some of the config files. Default: %(default)s", | ||
) | ||
|
||
parser.add_argument( | ||
"--report-stats", | ||
action="store", | ||
help="Whether the generated config reports anonymized usage statistics", | ||
choices=["yes", "no"], | ||
) | ||
|
||
parser.add_argument( | ||
"--generate-secrets", | ||
action="store_true", | ||
help="Enable generation of new secrets for things like the macaroon_secret_key." | ||
"By default, these parameters will be left unset." | ||
) | ||
|
||
parser.add_argument( | ||
"-o", "--output-file", | ||
type=argparse.FileType('w'), | ||
default=sys.stdout, | ||
help="File to write the configuration to. Default: stdout", | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
report_stats = args.report_stats | ||
if report_stats is not None: | ||
report_stats = report_stats == "yes" | ||
|
||
conf = HomeServerConfig().generate_config( | ||
config_dir_path=args.config_dir, | ||
data_dir_path=args.data_dir, | ||
server_name=args.server_name, | ||
generate_secrets=args.generate_secrets, | ||
report_stats=report_stats, | ||
) | ||
|
||
args.output_file.write(conf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters