Skip to content

Commit c30f775

Browse files
committed
i2package configuration
1 parent 3a02ef2 commit c30f775

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Package initialization file.
2+
3+
from .interface import *
4+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This module defines the public interface for our "configpackage" package.
2+
3+
def init(config):
4+
global settings
5+
6+
settings = {}
7+
settings['log_errors'] = config.get("log_errors", False)
8+
settings['db_password'] = config.get("db_password", "")
9+
10+
11+
def test():
12+
global settings
13+
14+
if settings['log_errors']:
15+
print("Error logging enabled")
16+
else:
17+
print("Error logging disabled")
18+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import configpackage
2+
3+
configpackage.init({'log_errors': True})
4+
configpackage.test()

0 commit comments

Comments
 (0)