add bootstrap script to start the server up the same way
This commit is contained in:
@@ -13,8 +13,9 @@
|
||||
# For more info see docs.battlesnake.com
|
||||
|
||||
from server.CreateEnvironmentFile import CreateEnvironmentFile
|
||||
from server.Server import Server
|
||||
from server.bootstrap import build_run_config, build_server_from_env
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
# Start server when `python main.py` is run
|
||||
@@ -26,19 +27,5 @@ if __name__ == "__main__":
|
||||
"SNAKE": "TemplateSnake",
|
||||
})
|
||||
|
||||
server = Server(
|
||||
data_path=os.path.dirname(__file__),
|
||||
snake_type=os.environ.get("SNAKE", "TemplateSnake"),
|
||||
storage_type=os.environ.get("STORAGE", "LocalStorage"),
|
||||
debug=os.environ.get("DEBUG_SERVER", False),
|
||||
check_tls_security=False,
|
||||
)
|
||||
|
||||
if os.environ.get("STORE_GAME_HISTORY", None):
|
||||
server.enable_store_game_state()
|
||||
|
||||
server.run(
|
||||
host=os.environ.get("HOST", "0.0.0.0"),
|
||||
port=int(os.environ.get("PORT", "8000")),
|
||||
debug=bool(os.environ.get("DEBUG", False)),
|
||||
)
|
||||
server = build_server_from_env(default_snake_type="TemplateSnake")
|
||||
asyncio.run(server.run(**build_run_config()))
|
||||
|
||||
Reference in New Issue
Block a user