Skip to content

Commit

Permalink
Merge pull request #212 from NationalLibraryOfNorway/feat/conf-using-env
Browse files Browse the repository at this point in the history
feat: config using env variables
  • Loading branch information
magbb authored Aug 2, 2024
2 parents 52a6c37 + baef5d5 commit efb76e3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
3 changes: 0 additions & 3 deletions dhlab.env

This file was deleted.

11 changes: 4 additions & 7 deletions dhlab/constants.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import os
from dotenv import load_dotenv

load_dotenv("dhlab.env") # take environment variables
"""Constant variables used across modules, override using environment variable"""

"""Constant variables used across modules, change in dhlab.env or through environment variable"""

BASE_URL = os.getenv("NB_DHLAB_BASE_URL") #: REST-API URL adress to fulltext query functions
NGRAM_API = os.getenv("NB_DHLAB_NGRAM_API") #: URL adress for API calls to ngram-databases
GALAXY_API = os.getenv("NB_DHLAB_GALAXY_API") #: URL adress for word galaxy API queries
BASE_URL = os.getenv("NB_DHLAB_BASE_URL", "https://api.nb.no/dhlab") #: REST-API URL adress to fulltext query functions
NGRAM_API = os.getenv("NB_DHLAB_NGRAM_API", "https://api.nb.no/dhlab/nb_ngram/ngram/query") #: URL adress for API calls to ngram-databases
GALAXY_API = os.getenv("NB_DHLAB_GALAXY_API", "https://api.nb.no/dhlab/nb_ngram_galaxies/galaxies/query") #: URL adress for word galaxy API queries
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
include = ["CHANGELOG.md", "LICENSE", "dhlab.env"]
include = ["CHANGELOG.md", "LICENSE"]
exclude = ["docs/", "tests/"]

[tool.poetry.urls]
Expand All @@ -34,7 +34,6 @@ scipy = { version = "^1.11.3", python = ">=3.9,<3.13" }
openpyxl = "^3.1.2"
beautifulsoup4 = "^4.12.2"
numpy = "^1.26.3"
python-dotenv = "^1.0.1"

[tool.poetry.group.docs.dependencies]
Sphinx = "^7.2.6"
Expand Down

0 comments on commit efb76e3

Please sign in to comment.