not check tls certificat when connection to server by default

This commit is contained in:
2025-03-08 12:13:46 +01:00
parent 31d2e7ea55
commit 0768e7f254
2 changed files with 17 additions and 8 deletions
+2 -1
View File
@@ -27,7 +27,8 @@ if __name__ == "__main__":
snake_type=os.environ.get("SNAKE", "TemplateSnake"),
storage_type=os.environ.get("STORAGE", "LocalStorage"),
store_game_when_win_and_moves_are_bigger_as=int(os.environ.get("STORE_IF_WIN_AND_MOVES_ARE_BIGGER_AS", 10)),
debug=os.environ.get("DEBUG_SERVER", False)
debug=os.environ.get("DEBUG_SERVER", False),
check_tls_security=False
)
if os.environ.get("STORE_GAME_HISTORY", None):
+15 -7
View File
@@ -11,13 +11,14 @@ import logging, json, os, re
class Server:
default_snake_config = {"apiversion":"1","author":"","color":"#888888","head":"default","tail":"default"}
def __init__(self, data_path:str, snake_type:str, storage_type:str, debug:bool=False, store_game_when_win_and_moves_are_bigger_as:int=10):
def __init__(self, data_path:str, snake_type:str, storage_type:str, debug:bool=False, store_game_when_win_and_moves_are_bigger_as:int=10, check_tls_security:bool=False):
self.debug = debug
self.snake_type = snake_type
self.storage_type = storage_type
self.config_file = os.path.join(data_path, 'data', 'snake-config.json')
self.data_path = data_path
self.check_tls_security = check_tls_security
self.store_game_state = False
self.store_game_when_win_and_moves_are_bigger_as = store_game_when_win_and_moves_are_bigger_as
@@ -135,12 +136,19 @@ class Server:
if self.store_game_state:
game_board = self._get_game_board(game_state, end=True)
#if not game_board.get_winner() == "me" and not game_board.get_turn() <= self.store_game_when_win_and_moves_are_bigger_as:
game_board.save(
StorageLoader.build(self.storage_type),
file_path=os.path.join(self.data_path, 'data'),
database=os.getenv("EDGEDB_DATABASE", None),
tls_security=None
)
if self.check_tls_security:
game_board.save(
StorageLoader.build(self.storage_type),
file_path=os.path.join(self.data_path, 'data'),
database=os.getenv("EDGEDB_DATABASE", None),
tls_security=None
)
else:
game_board.save(
StorageLoader.build(self.storage_type),
file_path=os.path.join(self.data_path, 'data'),
database=os.getenv("EDGEDB_DATABASE", None),
)
print("GAME ENDED: Winner is", [ x["name"] for x in game_state["board"]['snakes']])
self._delete_game_board(game_state)