Skip to content

Commit

Permalink
Add doc for local config with .env (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmwinther authored Jan 30, 2024
1 parent d8abc32 commit c395c49
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,24 @@ poetry run python
poetry run datadoc
```

## Config for local development

We use a python package called `python-dotenv` for configuration management. This gives two possibilities for sourcing configuration:

1. Environment variables.
1. A file called `.env` by convention.

To set up for local development run this command from the root of the repo.

1. Create a file `src/datadoc/.env`
1. Place the following lines in the file:
```
DATADOC_DASH_DEVELOPMENT_MODE=True
DATADOC_LOG_LEVEL=debug
```

To see all configuration options, see `src/datadoc/config.py`

## How to test the project

Run the full test suite:
Expand Down
4 changes: 3 additions & 1 deletion src/datadoc/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ def main(dataset_path: str | None = None) -> None:
port=port,
)
else:
app.run(debug=config.get_dash_development_mode(), port=port)
if dev_mode := config.get_dash_development_mode():
logger.warning("Starting in Development Mode. NOT SUITABLE FOR PRODUCTION.")
app.run(debug=dev_mode, port=port)


if __name__ == "__main__":
Expand Down

0 comments on commit c395c49

Please sign in to comment.