-
Notifications
You must be signed in to change notification settings - Fork 2
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
078b22a
commit 3ec7ba3
Showing
25 changed files
with
380 additions
and
552 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,41 @@ | ||
from config.vault import get_vault | ||
|
||
class Settings: | ||
def __init__(self): | ||
self.environment = "development" | ||
self.debug = False | ||
self.seeding = False | ||
self.migrations = True | ||
|
||
def get_setting(self, setting): | ||
return self.__getattribute__(setting) | ||
|
||
def get_settings(self): | ||
return self | ||
|
||
def get_environment(self): | ||
return self.environment | ||
|
||
def set_environment(self, environment: str): | ||
allowed_environments = ["prod", "production", "development", "dev", "testing"] | ||
environment = environment.lower() | ||
if any(allowed_environment in environment for allowed_environment in allowed_environments): | ||
self.environment = environment | ||
return {'message': 'Environment successfully set to {}'.format(environment), 'code': 200} | ||
|
||
raise ValueError('Environment {} is not valid. Must be one of following values: {}'.format(environment, allowed_environments)) | ||
|
||
@staticmethod | ||
def get_token(): | ||
vault = get_vault() | ||
return vault.token | ||
|
||
@staticmethod | ||
def get_hostname(): | ||
vault = get_vault() | ||
return vault.hostname | ||
|
||
@staticmethod | ||
def get_database(): | ||
vault = get_vault() | ||
return vault.database |
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,9 @@ | ||
class Directories: | ||
migrations = f"database/migrations" | ||
seeders = f"database/seeders" | ||
|
||
def get_directory(self, directory): | ||
return self.__getattribute__(directory) | ||
|
||
def get_directories(self): | ||
return self |
Oops, something went wrong.