Skip to content

Commit

Permalink
Add version to log output
Browse files Browse the repository at this point in the history
  • Loading branch information
TheHolyRoger committed May 19, 2023
1 parent 4cda232 commit 17b597b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rogerthat/app/rogerthat.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def start_queues(self):
self._mqtt_queue = mqtt_queue.get_instance()

def start_server(self):
logger.info("RogerThat startup.")
logger.info(f"RogerThat v{Config.get_inst().version} starting.")
self.setup_loop()
self.start_queues()
logger.info("Starting RogerThat Server.")
Expand Down
2 changes: 2 additions & 0 deletions rogerthat/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from rogerthat.config.loader import config_loader
from rogerthat.utils.class_helpers import no_setters
from rogerthat.utils.version_number import get_version_number

_loaded_configs = config_loader()
_app_config = _loaded_configs.app_config
Expand All @@ -15,6 +16,7 @@
class Config(no_setters):
# Main App
_project_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
_version = get_version_number(_project_root)
_app_name = _app_config['app_name']
_debug_mode = _app_config['debug_mode']

Expand Down
9 changes: 9 additions & 0 deletions rogerthat/utils/version_number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import os


def get_version_number(root_folder):
version = None
with open(os.path.join(root_folder, "VERSION"), "r") as fp:
version = fp.readlines(1)[0]

return version

0 comments on commit 17b597b

Please sign in to comment.