diff --git a/flake.nix b/flake.nix index ba0a5fb..ebd78b9 100644 --- a/flake.nix +++ b/flake.nix @@ -134,9 +134,9 @@ packages.x86_64-linux.ozai-webui-run = pkgs.stdenv.mkDerivation rec { serviceConfig = { #ExecStart = "${self.packages.x86_64-linux.ozai-webui-run}/bin/run ${config.services.ozai-webui.host} ${toString(config.services.ozai-webui.port)} ${self.packages.x86_64-linux.default}/bin"; - # ExecStart = "${self.packages.x86_64-linux.ozai-webui-run}/bin/run ${config.services.ozai-webui.host} ${toString(config.services.ozai-webui.port)} ${self.packages.x86_64-linux.default}/lib/python3.11/site-packages/"; + ExecStart = "${self.packages.x86_64-linux.ozai-webui-run}/bin/run ${config.services.ozai-webui.host} ${toString(config.services.ozai-webui.port)} ${self.packages.x86_64-linux.default}/lib/python3.11/site-packages/"; # ExecStart = "${self.packages.x86_64-linux.ozai-webui}/bin/ozai-webui"; - ExecStart = "${self.packages.x86_64-linux.default}/bin/ozai_webui"; + # ExecStart = "${self.packages.x86_64-linux.default}/bin/ozai_webui"; Restart = "always"; }; }; diff --git a/src/ozai_webui/__init__.py b/src/ozai_webui/__init__.py index a50a012..08ca2b2 100755 --- a/src/ozai_webui/__init__.py +++ b/src/ozai_webui/__init__.py @@ -37,31 +37,31 @@ app = Flask(__name__,template_folder=template_folder,static_folder=static_folder socketio = SocketIO(app) app.config['SECRET_KEY'] = "secret" -#parser = argparse.ArgumentParser(description="Run the Ozai WebUI server") -# -#parser.add_argument('-H', '--host', type=str, default=ozai_webui_host, help='The host to run the server on') -#parser.add_argument('-P', '--port', type=int, default=ozai_webui_port, help='The port to run the server on') -#parser.add_argument('-O', '--ozai_url', type=str, default=ozai_url, help='The URL of the Ozai server') -#parser.add_argument('-S', '--secret_key', type=str, default=app.config['SECRET_KEY'], help='The secret key for the Flask app') -#parser.add_argument('--static_folder', type=str, default=static_folder, help='The location of the static folder') -#parser.add_argument('--template_folder', type=str, default=template_folder, help='The location of the template folder') -# -# -#args = parser.parse_args() -# -#if args.host: -# ozai_webui_host = args.host -#if args.port: -# ozai_webui_port = args.port -#if args.ozai_url: -# ozai_url = args.ozai_url -#if args.secret_key: -# app.config['SECRET_KEY'] = args.secret_key -#if args.static_folder: -# app.static_folder = args.static_folder -#if args.template_folder: -# app.template_folder = args.template_folder -# +parser = argparse.ArgumentParser(description="Run the Ozai WebUI server") + +parser.add_argument('-H', '--host', type=str, default=ozai_webui_host, help='The host to run the server on') +parser.add_argument('-P', '--port', type=int, default=ozai_webui_port, help='The port to run the server on') +parser.add_argument('-O', '--ozai_url', type=str, default=ozai_url, help='The URL of the Ozai server') +parser.add_argument('-S', '--secret_key', type=str, default=app.config['SECRET_KEY'], help='The secret key for the Flask app') +parser.add_argument('--static_folder', type=str, default=static_folder, help='The location of the static folder') +parser.add_argument('--template_folder', type=str, default=template_folder, help='The location of the template folder') + + +args = parser.parse_args() + +if args.host: + ozai_webui_host = args.host +if args.port: + ozai_webui_port = args.port +if args.ozai_url: + ozai_url = args.ozai_url +if args.secret_key: + app.config['SECRET_KEY'] = args.secret_key +if args.static_folder: + app.static_folder = args.static_folder +if args.template_folder: + app.template_folder = args.template_folder + #home page @app.route('/') @@ -221,9 +221,9 @@ def ws_message(data): socketio.emit('move_status', response.text, room=game_id) def main (): - # return app.run(host=ozai_webui_host, port=ozai_webui_port) + return app.run(host=ozai_webui_host, port=ozai_webui_port) #return socketio.run(app, debug=False, host=ozai_webui_host, port=ozai_webui_port, allow_unsafe_werkzeug=True) - return socketio.run(app, debug=False, host=ozai_webui_host, port=ozai_webui_port) + # return socketio.run(app, debug=False, host=ozai_webui_host, port=ozai_webui_port) if __name__ == '__main__': main()