Document and add debug arguments for read-only behavior.
This commit is contained in:
parent
e5440329ec
commit
5941a98b66
@ -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("-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("-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("-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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Set up app
|
# Set up app
|
||||||
load_config(args.config)
|
load_config(args.config)
|
||||||
|
if args.read_only:
|
||||||
|
config['database']['read_only'] = True
|
||||||
|
|
||||||
if args.profile:
|
if args.profile:
|
||||||
from werkzeug.contrib.profiler import ProfilerMiddleware
|
from werkzeug.contrib.profiler import ProfilerMiddleware
|
||||||
|
@ -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("-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("-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("-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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Set up app
|
# Set up app
|
||||||
load_config(args.config)
|
load_config(args.config)
|
||||||
|
if args.read_only:
|
||||||
|
config['database']['read_only'] = True
|
||||||
|
|
||||||
# Register all blueprints
|
# Register all blueprints
|
||||||
register_blueprints()
|
register_blueprints()
|
||||||
|
@ -72,11 +72,14 @@ def run_scheduled_work(config: Config) -> None:
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = argparse.ArgumentParser(description="A scheduler for work that needs to be done periodically.")
|
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("-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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Set up global configuration
|
# Set up global configuration
|
||||||
config = Config()
|
config = Config()
|
||||||
load_config(args.config, config)
|
load_config(args.config, config)
|
||||||
|
if args.read_only:
|
||||||
|
config['database']['read_only'] = True
|
||||||
|
|
||||||
# Run out of band work
|
# Run out of band work
|
||||||
run_scheduled_work(config)
|
run_scheduled_work(config)
|
||||||
|
@ -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("-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("-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("-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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Set up global configuration, overriding config port for convenience in debugging.
|
# Set up global configuration, overriding config port for convenience in debugging.
|
||||||
load_config(args.config)
|
load_config(args.config)
|
||||||
config['server']['port'] = args.port
|
config['server']['port'] = args.port
|
||||||
|
if args.read_only:
|
||||||
|
config['database']['read_only'] = True
|
||||||
|
|
||||||
# Register game handlers
|
# Register game handlers
|
||||||
register_games()
|
register_games()
|
||||||
|
@ -7,6 +7,10 @@ database:
|
|||||||
user: "bemani"
|
user: "bemani"
|
||||||
# Password of said user.
|
# Password of said user.
|
||||||
password: "bemani"
|
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:
|
server:
|
||||||
# Advertised server IP or DNS entry games will connect to.
|
# Advertised server IP or DNS entry games will connect to.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user