1
0
mirror of synced 2025-01-31 12:13:49 +01:00

Document and add debug arguments for read-only behavior.

This commit is contained in:
Jennifer Taylor 2021-08-20 19:37:26 +00:00
parent e5440329ec
commit 5941a98b66
5 changed files with 16 additions and 0 deletions

View File

@ -14,10 +14,13 @@ def main() -> None:
parser.add_argument("-p", "--port", help="Port to listen on. Defaults to 80", type=int, default=80)
parser.add_argument("-c", "--config", help="Core configuration. Defaults to server.yaml", type=str, default="server.yaml")
parser.add_argument("-r", "--profile", help="Turn on profiling for API, writing CProfile data to the currenct directory", action="store_true")
parser.add_argument("-o", "--read-only", action="store_true", help="Force the database into read-only mode.")
args = parser.parse_args()
# Set up app
load_config(args.config)
if args.read_only:
config['database']['read_only'] = True
if args.profile:
from werkzeug.contrib.profiler import ProfilerMiddleware

View File

@ -59,10 +59,13 @@ def main() -> None:
parser.add_argument("-p", "--port", help="Port to listen on. Defaults to 80", type=int, default=80)
parser.add_argument("-c", "--config", help="Core configuration. Defaults to server.yaml", type=str, default="server.yaml")
parser.add_argument("-r", "--profile", help="Turn on profiling for front end, writing CProfile data to the currenct directory", action="store_true")
parser.add_argument("-o", "--read-only", action="store_true", help="Force the database into read-only mode.")
args = parser.parse_args()
# Set up app
load_config(args.config)
if args.read_only:
config['database']['read_only'] = True
# Register all blueprints
register_blueprints()

View File

@ -72,11 +72,14 @@ def run_scheduled_work(config: Config) -> None:
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="A scheduler for work that needs to be done periodically.")
parser.add_argument("-c", "--config", help="Core configuration. Defaults to server.yaml", type=str, default="server.yaml")
parser.add_argument("-o", "--read-only", action="store_true", help="Force the database into read-only mode.")
args = parser.parse_args()
# Set up global configuration
config = Config()
load_config(args.config, config)
if args.read_only:
config['database']['read_only'] = True
# Run out of band work
run_scheduled_work(config)

View File

@ -127,11 +127,14 @@ if __name__ == '__main__':
parser.add_argument("-p", "--port", help="Port to listen on. Defaults to 80", type=int, default=80)
parser.add_argument("-c", "--config", help="Core configuration. Defaults to server.yaml", type=str, default="server.yaml")
parser.add_argument("-r", "--profile", help="Turn on profiling for services, writing CProfile data to the currenct directory", action="store_true")
parser.add_argument("-o", "--read-only", action="store_true", help="Force the database into read-only mode.")
args = parser.parse_args()
# Set up global configuration, overriding config port for convenience in debugging.
load_config(args.config)
config['server']['port'] = args.port
if args.read_only:
config['database']['read_only'] = True
# Register game handlers
register_games()

View File

@ -7,6 +7,10 @@ database:
user: "bemani"
# Password of said user.
password: "bemani"
# Force the network to read-only mode, refusing to write to the DB
# except for creating/destroying frontend sessions to enable login.
# Set this to False or delete this to run in production mode.
read_only: False
server:
# Advertised server IP or DNS entry games will connect to.