Skip to content

Commit

Permalink
Merge pull request #48 from cicekhayri/config
Browse files Browse the repository at this point in the history
Initialize object with optional parameters: secret_key and config. If…
  • Loading branch information
cicekhayri authored Jan 8, 2024
2 parents 18bd349 + 22e18e0 commit 60d0e95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions inspira/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def __init__(self):
"SESSION_COOKIE_SECURE": True,
"SESSION_COOKIE_SAMESITE": None,
"TOKEN_EXPIRATION_TIME": 3600,
"SECRET_KEY": "change_me"
}

def __getitem__(self, key):
Expand Down
8 changes: 5 additions & 3 deletions inspira/inspira.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@


class Inspira:
def __init__(self, secret_key=None, config=Config()):
self.config = config
set_global_app(self, secret_key)
def __init__(self, secret_key=None, config=None):
self.config = config if config is not None else Config()
self.secret_key = secret_key if secret_key is not None else self.config['SECRET_KEY']
set_global_app(self, self.secret_key)

self.routes: Dict[str, Dict[str, Callable]] = {
method.value: {} for method in HttpMethod
}
Expand Down

0 comments on commit 60d0e95

Please sign in to comment.