Formatting
This commit is contained in:
@@ -26,6 +26,7 @@ def build_container_routing_labels(prefix: str, strip_prefix=True):
|
|||||||
|
|
||||||
return labels
|
return labels
|
||||||
|
|
||||||
|
|
||||||
def stop_container(docker_id):
|
def stop_container(docker_id):
|
||||||
try:
|
try:
|
||||||
client = docker.from_env()
|
client = docker.from_env()
|
||||||
@@ -53,7 +54,10 @@ def start_foundry_container(table: GameTable, key: KeyTable, version=12):
|
|||||||
image = "felddy/foundryvtt:{version}".format(version=version)
|
image = "felddy/foundryvtt:{version}".format(version=version)
|
||||||
labels = build_container_routing_labels(table.game_table_link, False)
|
labels = build_container_routing_labels(table.game_table_link, False)
|
||||||
os.makedirs("/data/" + table.game_table_link + "/Config", exist_ok=True)
|
os.makedirs("/data/" + table.game_table_link + "/Config", exist_ok=True)
|
||||||
shutil.copyfile(src="/data/keys/" + key.key_file, dst="/data/"+table.game_table_link+"/Config/license.json")
|
shutil.copyfile(
|
||||||
|
src="/data/keys/" + key.key_file,
|
||||||
|
dst="/data/" + table.game_table_link + "/Config/license.json",
|
||||||
|
)
|
||||||
volumes = {
|
volumes = {
|
||||||
"/home/cow/Projects/dockertesting/data/{prefix}".format(
|
"/home/cow/Projects/dockertesting/data/{prefix}".format(
|
||||||
prefix=table.game_table_link
|
prefix=table.game_table_link
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ CREATE TABLE IF NOT EXISTS "game_keys" (
|
|||||||
);
|
);
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def init_db(connection):
|
def init_db(connection):
|
||||||
with SmartCursor(connection=connection) as smart_cursor:
|
with SmartCursor(connection=connection) as smart_cursor:
|
||||||
smart_cursor.execute(_game_table_create)
|
smart_cursor.execute(_game_table_create)
|
||||||
|
|||||||
@@ -10,7 +10,12 @@ class KeyTable:
|
|||||||
updated: bool
|
updated: bool
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, key: str, game_table_id: int, key_file: str, created: bool = True, updated: bool = True
|
self,
|
||||||
|
key: str,
|
||||||
|
game_table_id: int,
|
||||||
|
key_file: str,
|
||||||
|
created: bool = True,
|
||||||
|
updated: bool = True,
|
||||||
):
|
):
|
||||||
self.key = key
|
self.key = key
|
||||||
self.game_table_id = game_table_id
|
self.game_table_id = game_table_id
|
||||||
@@ -19,7 +24,11 @@ class KeyTable:
|
|||||||
self.updated = updated
|
self.updated = updated
|
||||||
|
|
||||||
def toJson(self):
|
def toJson(self):
|
||||||
return {"key": self.key, "table_id": self.game_table_id, "key_file": self.key_file}
|
return {
|
||||||
|
"key": self.key,
|
||||||
|
"table_id": self.game_table_id,
|
||||||
|
"key_file": self.key_file,
|
||||||
|
}
|
||||||
|
|
||||||
def reserve(self, game_table_id):
|
def reserve(self, game_table_id):
|
||||||
self.game_table_id = game_table_id
|
self.game_table_id = game_table_id
|
||||||
|
|||||||
Reference in New Issue
Block a user