Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the name of the dev env #41

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A python boilerplate project using poetry

Variable | Description | Available Values | Default Value | Required
--- | --- | --- | --- | ---
ENV | The application enviroment | `development / test / qa / prod` | `development` | Yes
ENV | The application enviroment | `dev / test / qa / prod` | `dev` | Yes

*Note: When you run the install command (using docker or locally), a .env file will be created automatically based on [env.template](env.template)*

Expand Down
2 changes: 1 addition & 1 deletion settings.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[default]
app_name=python-boilerplate-project

[development]
[dev]

[test]

Expand Down
2 changes: 1 addition & 1 deletion src/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Settings:
def __init__(self, file: str = 'settings.conf'):
self.config_parser = ConfigParser()
self.config_parser.read(file)
self.env = getenv('ENV', 'development')
self.env = getenv('ENV', 'dev')

def get(self, name: str, default_value: Any = None) -> Any:
return self._get_from_section(self.env, name) or self._get_from_section('default', name) or default_value
Expand Down
4 changes: 2 additions & 2 deletions tests/config/settings_to_test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ app_var=default-app-var
sample_of_int_var=10
sample_of_float_var=10.10

[development]
app_var=development-app-var
[dev]
app_var=dev-app-var

[test]
app_var=test-app-var
Expand Down
6 changes: 3 additions & 3 deletions tests/config/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_get_setting_value_from_test_env_with_success(self):
test_settings = Settings(file='./tests/config/settings_to_test.conf')
self.assertEqual(test_settings.get('app_var'), 'test-app-var')

@mock.patch.dict(os.environ, {'ENV': 'development'}, clear=True)
def test_get_setting_value_from_development_env_with_success(self):
@mock.patch.dict(os.environ, {'ENV': 'dev'}, clear=True)
def test_get_setting_value_from_dev_env_with_success(self):
dev_settings = Settings(file='./tests/config/settings_to_test.conf')
self.assertEqual(dev_settings.get('app_var'), 'development-app-var')
self.assertEqual(dev_settings.get('app_var'), 'dev-app-var')
Loading