|
|
|
@ -150,6 +150,7 @@ class Config(object): |
|
|
|
|
server_name, |
|
|
|
|
generate_secrets=False, |
|
|
|
|
report_stats=None, |
|
|
|
|
open_private_ports=False, |
|
|
|
|
): |
|
|
|
|
"""Build a default configuration file |
|
|
|
|
|
|
|
|
@ -173,6 +174,9 @@ class Config(object): |
|
|
|
|
report_stats (bool|None): Initial setting for the report_stats setting. |
|
|
|
|
If None, report_stats will be left unset. |
|
|
|
|
|
|
|
|
|
open_private_ports (bool): True to leave private ports (such as the non-TLS |
|
|
|
|
HTTP listener) open to the internet. |
|
|
|
|
|
|
|
|
|
Returns: |
|
|
|
|
str: the yaml config file |
|
|
|
|
""" |
|
|
|
@ -185,6 +189,7 @@ class Config(object): |
|
|
|
|
server_name=server_name, |
|
|
|
|
generate_secrets=generate_secrets, |
|
|
|
|
report_stats=report_stats, |
|
|
|
|
open_private_ports=open_private_ports, |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
@ -290,6 +295,23 @@ class Config(object): |
|
|
|
|
" config file." |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
generate_group.add_argument( |
|
|
|
|
"--data-directory", |
|
|
|
|
metavar="DIRECTORY", |
|
|
|
|
help=( |
|
|
|
|
"Specify where data such as the media store and database file should be" |
|
|
|
|
" stored. Defaults to the current working directory." |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
generate_group.add_argument( |
|
|
|
|
"--open-private-ports", |
|
|
|
|
action="store_true", |
|
|
|
|
help=( |
|
|
|
|
"Leave private ports (such as the non-TLS HTTP listener) open to the" |
|
|
|
|
" internet. Do not use this unless you know what you are doing." |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
config_args, remaining_args = config_parser.parse_known_args(argv) |
|
|
|
|
|
|
|
|
|
config_files = find_config_files(search_paths=config_args.config_path) |
|
|
|
@ -323,6 +345,12 @@ class Config(object): |
|
|
|
|
if not cls.path_exists(config_path): |
|
|
|
|
print("Generating config file %s" % (config_path,)) |
|
|
|
|
|
|
|
|
|
if config_args.data_directory: |
|
|
|
|
data_dir_path = config_args.data_directory |
|
|
|
|
else: |
|
|
|
|
data_dir_path = os.getcwd() |
|
|
|
|
data_dir_path = os.path.abspath(data_dir_path) |
|
|
|
|
|
|
|
|
|
server_name = config_args.server_name |
|
|
|
|
if not server_name: |
|
|
|
|
raise ConfigError( |
|
|
|
@ -336,6 +364,7 @@ class Config(object): |
|
|
|
|
server_name=server_name, |
|
|
|
|
report_stats=(config_args.report_stats == "yes"), |
|
|
|
|
generate_secrets=True, |
|
|
|
|
open_private_ports=config_args.open_private_ports, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
if not cls.path_exists(config_dir_path): |
|
|
|
|