NXPR-3 Work
This commit is contained in:
parent
b02ecf706f
commit
e93d53b1f2
@ -1,3 +1,7 @@
|
||||
server_name: "valhalla"
|
||||
server_port: 8088
|
||||
logging_level: "INFO"
|
||||
server_loglevel: "INFO"
|
||||
database_file: "database.db"
|
||||
server_host: "localhost"
|
||||
server_password: "sekret_password"
|
||||
server_access_username: "user"
|
7
config.yml
Normal file
7
config.yml
Normal file
@ -0,0 +1,7 @@
|
||||
server_name: "valhalla"
|
||||
server_port: 8088
|
||||
server_loglevel: "INFO"
|
||||
database_file: "database.db"
|
||||
server_host: "localhost"
|
||||
server_password: "sekret_password"
|
||||
server_access_username: "user"
|
@ -1,5 +1,12 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import flask
|
||||
from network.communication import Server
|
||||
from utils.config.config import ServerConfig
|
||||
|
||||
config = ServerConfig()
|
||||
server = Server(host=config.server_host, port=config.server_port, name=config.server_name, access_password=config.server_password,
|
||||
access_username=config.server_access_username, version="v0.0.1alpha", database_file_path=config.database_file, logging_level=config.server_loglevel)
|
||||
|
||||
server.run()
|
||||
|
||||
# vi: ft=python
|
||||
|
@ -0,0 +1 @@
|
||||
from . import communication
|
BIN
network/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
network/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
network/__pycache__/communication.cpython-310.pyc
Normal file
BIN
network/__pycache__/communication.cpython-310.pyc
Normal file
Binary file not shown.
@ -24,11 +24,12 @@ class FlaskAppWrapper(object):
|
||||
|
||||
class Server():
|
||||
|
||||
def __init__(self, host: str, port: int, name: str, access_password: str, version: str, database_file_path: str, logging_level: str):
|
||||
def __init__(self, host: str, port: int, name: str, access_password: str, access_username: str, version: str, database_file_path: str, logging_level: str, ):
|
||||
self.host = host
|
||||
self.port = port
|
||||
self.name = name
|
||||
self.access_password = access_password
|
||||
self.access_username = access_username
|
||||
self.version = version
|
||||
self.database = Database(
|
||||
database_file=database_file_path, logging_level=logging_level)
|
||||
|
@ -0,0 +1 @@
|
||||
from . import *
|
BIN
utils/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
utils/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
@ -1 +1 @@
|
||||
from utils.config import ServerConfig
|
||||
from . import config
|
||||
|
BIN
utils/config/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
utils/config/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
utils/config/__pycache__/config.cpython-310.pyc
Normal file
BIN
utils/config/__pycache__/config.cpython-310.pyc
Normal file
Binary file not shown.
@ -1,11 +1,12 @@
|
||||
import os
|
||||
import yaml
|
||||
|
||||
|
||||
class ServerConfig:
|
||||
def __init__(self):
|
||||
config_file = {}
|
||||
|
||||
with open("~/.config/orchestrator/config.yml", "r") as stream:
|
||||
with open("config.yml", "r") as stream:
|
||||
try:
|
||||
config_file = yaml.safe_load(stream)
|
||||
except Exception as e:
|
||||
@ -15,7 +16,12 @@ class ServerConfig:
|
||||
|
||||
server_name_override = os.environ.get("VALHALLA_SERVER_NAME")
|
||||
server_port_override = os.environ.get("VALHALLA_SERVER_PORT")
|
||||
server_host_override = os.environ.get("VALHALLA_SERVER_HOST")
|
||||
server_password_override = os.environ.get("VALHALLA_SERVER_PASSWORD")
|
||||
server_access_username_override = os.environ.get(
|
||||
"VALHALLA_SERVER_ACCESS_USERNAME")
|
||||
database_file_override = os.environ.get("VALHALLA_DATABASE_FILE")
|
||||
server_logging_override = os.environ.get("VALHALLA_LOGLEVEL")
|
||||
|
||||
if server_name_override:
|
||||
config["server_name"] = server_name_override
|
||||
@ -23,10 +29,25 @@ class ServerConfig:
|
||||
if server_port_override:
|
||||
config["server_port"] = server_port_override
|
||||
|
||||
if server_host_override:
|
||||
config["server_host"] = server_host_override
|
||||
|
||||
if database_file_override:
|
||||
config["database_file"] = database_file_override
|
||||
|
||||
if server_password_override:
|
||||
config["server_password"] = server_password_override
|
||||
|
||||
if server_access_username_override:
|
||||
config["server_access_username"] = server_access_username_override
|
||||
|
||||
if server_logging_override:
|
||||
config["server_loglevel"] = server_logging_override
|
||||
|
||||
self.server_name = config["server_name"]
|
||||
self.server_port = config["server_port"]
|
||||
self.database_file = config["database_file"]
|
||||
|
||||
self.server_host = config["server_host"]
|
||||
self.server_password = config["server_password"]
|
||||
self.server_access_username = config["server_access_username"]
|
||||
self.server_loglevel = config["server_loglevel"]
|
||||
|
@ -0,0 +1 @@
|
||||
from . import database
|
BIN
utils/database/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
utils/database/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
utils/database/__pycache__/database.cpython-310.pyc
Normal file
BIN
utils/database/__pycache__/database.cpython-310.pyc
Normal file
Binary file not shown.
@ -1 +1 @@
|
||||
from DatabaseException import DatabaseException
|
||||
from . import DatabaseException
|
||||
|
BIN
utils/exceptions/__pycache__/DatabaseException.cpython-310.pyc
Normal file
BIN
utils/exceptions/__pycache__/DatabaseException.cpython-310.pyc
Normal file
Binary file not shown.
BIN
utils/exceptions/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
utils/exceptions/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
@ -1 +1 @@
|
||||
from utils.models import Client, VMImage
|
||||
from . import models
|
||||
|
BIN
utils/models/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
utils/models/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
utils/models/__pycache__/models.cpython-310.pyc
Normal file
BIN
utils/models/__pycache__/models.cpython-310.pyc
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user