Skip to content

Commit 438630a

Browse files
committed
Improved version configuration and on-load logging
1 parent ab2d260 commit 438630a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packet/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import os
66
import logging
7+
import json
78

89
import csh_ldap
910
from flask import Flask
@@ -24,14 +25,18 @@
2425
if os.path.exists(_pyfile_config):
2526
app.config.from_pyfile(_pyfile_config)
2627

27-
app.config["VERSION"] = __version__
28+
# Fetch the version number from the npm package file
29+
_package_file = open(os.path.join(_root_dir, "package.json"))
30+
app.config["VERSION"] = json.load(_package_file)["version"]
2831

2932
# Logger configuration
3033
logging.getLogger().setLevel(app.config["LOG_LEVEL"])
34+
app.logger.info("Launching packet v" + app.config["VERSION"])
3135

3236
# Initialize the extensions
3337
db = SQLAlchemy(app)
3438
migrate = Migrate(app, db)
39+
app.logger.info("SQLAlchemy pointed at " + repr(db.engine.url))
3540

3641
auth = OIDCAuthentication(app, issuer=app.config["OIDC_ISSUER"], client_registration_info={
3742
"client_id": app.config["OIDC_CLIENT_ID"],
@@ -42,7 +47,7 @@
4247
# LDAP
4348
_ldap = csh_ldap.CSHLDAP(app.config["LDAP_BIND_DN"], app.config["LDAP_BIND_PASS"])
4449

45-
app.logger.info("DB and LDAP configured")
50+
app.logger.info("OIDCAuth and LDAP configured")
4651

4752
# pylint: disable=wrong-import-position
4853
from . import models

0 commit comments

Comments
 (0)