-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
28 lines (18 loc) · 775 Bytes
/
main.py
File metadata and controls
28 lines (18 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Demo script showing how to use the configuration module."""
from src.config import ConfigLoader, Keys, Sections
def main():
# NOTE
# This implementation is only for demonstrating config functions. Delete as necessary.
print("Config Demo")
print()
config = ConfigLoader()
# Access values using constants (type-safe)
print("=== Using constants ===")
server_host = config.get(Sections.SERVER, Keys.HOST)
server_port = config.get_int(Sections.SERVER, Keys.PORT)
db_host = config.get(Sections.DATABASE, Keys.HOST)
db_port = config.get(Sections.DATABASE, Keys.PORT)
print(f"Server: {server_host}:{server_port}")
print(f"Database: {db_host}:{db_port}")
if __name__ == "__main__":
main()