-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5d72f0
commit 8891261
Showing
9 changed files
with
98 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,3 +127,7 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# Flask-MonitoringDashboard | ||
config.cfg | ||
flask_monitoringdashboard.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import configparser | ||
import os | ||
|
||
from version import __version__ | ||
from dotenv import load_dotenv | ||
|
||
load_dotenv() | ||
|
||
|
||
class FlaskMonitoringDashboardConfigParser(configparser.ConfigParser): | ||
def optionxform(self, optionstr): | ||
return optionstr | ||
|
||
def write(self, fp): | ||
if self._defaults: | ||
fp.write("[%s]\n" % configparser.DEFAULTSECT) | ||
for (key, value) in self._defaults.items(): | ||
fp.write("%s=%s\n" % (key, str(value).replace('\n', '\n\t'))) | ||
fp.write("\n") | ||
for section in self._sections: | ||
fp.write("[%s]\n" % section) | ||
for (key, value) in self._sections[section].items(): | ||
if key == "__name__": | ||
continue | ||
if (value is not None) or (self._optcre == self.OPTCRE): | ||
key = "=".join((key, str(value).replace('\n', '\n\t'))) | ||
fp.write("%s\n" % (key)) | ||
fp.write("\n") | ||
|
||
|
||
def build_config_file(): | ||
# Initialize the ConfigParser object | ||
config = FlaskMonitoringDashboardConfigParser() | ||
|
||
# Read the configuration file | ||
config.read('config.template.cfg') | ||
|
||
# Update the values in the configuration file | ||
def overwrite(section: str, options: list[str]): | ||
for option in options: | ||
config[section][option] = os.getenv( | ||
option, config.get(section, option)) | ||
|
||
|
||
overwrite('authentication', ['USERNAME', 'PASSWORD', 'SECURITY_TOKEN']) | ||
|
||
# Update the app version | ||
config['dashboard']['APP_VERSION'] = __version__ | ||
|
||
# Write the updated values to the config file | ||
with open('config.cfg', 'w') as configfile: | ||
config.write(configfile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[dashboard] | ||
APP_VERSION=1.0 | ||
CUSTOM_LINK=dashboard | ||
MONITOR_LEVEL=3 | ||
OUTLIER_DETECTION_CONSTANT=2.5 | ||
SAMPLING_PERIOD=20 | ||
ENABLE_LOGGING=True | ||
BRAND_NAME=OpenGSQ APIs Monitoring Dashboard | ||
TITLE_NAME=OpenGSQ APIs Monitoring Dashboard | ||
DESCRIPTION=Automatically monitor the ongoing performance improvements of OpenGSQ API services. | ||
SHOW_LOGIN_BANNER=True | ||
SHOW_LOGIN_FOOTER=True | ||
|
||
[authentication] | ||
USERNAME=admin | ||
PASSWORD=admin | ||
SECURITY_TOKEN=cc83733cb0af8b884ff6577086b87909 | ||
|
||
[database] | ||
TABLE_PREFIX= | ||
DATABASE=sqlite:///flask_monitoringdashboard.db | ||
|
||
[visualization] | ||
COLORS={'main':'[128,0,128]','static':'[255,255,0]'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,10 @@ | ||
attrs==23.2.0 | ||
blinker==1.7.0 | ||
certifi==2024.2.2 | ||
charset-normalizer==3.3.2 | ||
click==8.1.7 | ||
colorama==0.4.6 | ||
dnspython==2.6.1 | ||
flasgger==0.9.7.1 | ||
Flask==3.0.2 | ||
Flask_MonitoringDashboard==3.2.2 | ||
gunicorn==21.2.0 | ||
idna==3.6 | ||
itsdangerous==2.1.2 | ||
Jinja2==3.1.3 | ||
jsonschema==4.21.1 | ||
jsonschema-specifications==2023.12.1 | ||
Markdown==3.5.2 | ||
MarkupSafe==2.1.5 | ||
mistune==3.0.2 | ||
packaging==24.0 | ||
pymongo==4.6.2 | ||
python-dotenv==1.0.1 | ||
PyYAML==6.0.1 | ||
referencing==0.33.0 | ||
requests==2.31.0 | ||
rpds-py==0.18.0 | ||
schedule==1.2.1 | ||
six==1.16.0 | ||
tqdm==4.66.2 | ||
urllib3==2.2.1 | ||
Werkzeug==3.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '1.0.1' | ||
__version__ = '1.1.0' |