From 82648113896c44a0ab146d49ecd819c087a013ec Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Tue, 31 Jan 2023 23:01:02 +0100 Subject: [PATCH] WIP: upgrade server, fix headers --- upgrade_server/upgrade_server.py | 6 +----- upgrade_server/upgrade_server/api.py | 11 +++++++---- upgrade_server/upgrade_server/configuration.py | 2 +- upgrade_server/upgrade_server/crud.py | 2 +- upgrade_server/upgrade_server/models/files.py | 1 - 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/upgrade_server/upgrade_server.py b/upgrade_server/upgrade_server.py index 7ff2be2..143db60 100644 --- a/upgrade_server/upgrade_server.py +++ b/upgrade_server/upgrade_server.py @@ -8,7 +8,7 @@ __author__ = "Orsiris de Jong" __copyright__ = "Copyright (C) 2023 NetInvent" __license__ = "GPL-3.0-only" __build__ = "202303101" -__version__ = "0.0.1" +__version__ = "1.0.0" DEVEL=True @@ -19,10 +19,6 @@ from upgrade_server import configuration from ofunctions.logger_utils import logger_get_logger -#ROOT_DIR = os.path.abspath(os.path.dirname(__file__)) -#config_file = 'upgrade_server.conf' -#config_dict = configuration.load_config(os.path.join(ROOT_DIR, config_file) - config_dict = configuration.load_config() try: listen = config_dict['http_server']['listen'] diff --git a/upgrade_server/upgrade_server/api.py b/upgrade_server/upgrade_server/api.py index 2974ef3..a7e7d9a 100644 --- a/upgrade_server/upgrade_server/api.py +++ b/upgrade_server/upgrade_server/api.py @@ -1,10 +1,13 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- +__intname__ = "npbackup.upgrade_server.api" +__author__ = "Orsiris de Jong" +__copyright__ = "Copyright (C) 2023 NetInvent" +__license__ = "GPL-3.0-only" +__build__ = "202303101" __appname__ = "npbackup.upgrader" -__author__ = "Alan Smithee" -__build__ = "2022112201" -__version__ = "1.0-beta" + from typing import Literal import logging @@ -47,7 +50,7 @@ def get_current_username(credentials: HTTPBasicCredentials = Depends(security)): @app.get("/") -async def api_root(): +async def api_root(auth = Depends(get_current_username)): if crud.is_enabled(): return { "app": __appname__, diff --git a/upgrade_server/upgrade_server/configuration.py b/upgrade_server/upgrade_server/configuration.py index 05d08b2..50fe88e 100644 --- a/upgrade_server/upgrade_server/configuration.py +++ b/upgrade_server/upgrade_server/configuration.py @@ -8,7 +8,7 @@ __author__ = "Orsiris de Jong" __copyright__ = "Copyright (C) 2023 NetInvent" __license__ = "GPL-3.0-only" __build__ = "202303101" -__version__ = "0.0.1" + import os from ruamel.yaml import YAML diff --git a/upgrade_server/upgrade_server/crud.py b/upgrade_server/upgrade_server/crud.py index 8262e49..7a14875 100644 --- a/upgrade_server/upgrade_server/crud.py +++ b/upgrade_server/upgrade_server/crud.py @@ -8,7 +8,7 @@ __author__ = "Orsiris de Jong" __copyright__ = "Copyright (C) 2023 NetInvent" __license__ = "GPL-3.0-only" __build__ = "202303101" -__version__ = "0.0.1" + import os from typing import Optional, Union diff --git a/upgrade_server/upgrade_server/models/files.py b/upgrade_server/upgrade_server/models/files.py index ac1e65d..f040e27 100644 --- a/upgrade_server/upgrade_server/models/files.py +++ b/upgrade_server/upgrade_server/models/files.py @@ -8,7 +8,6 @@ __author__ = "Orsiris de Jong" __copyright__ = "Copyright (C) 2023 NetInvent" __license__ = "GPL-3.0-only" __build__ = "202303101" -__version__ = "0.0.1" from enum import Enum