Skip to content

Commit

Permalink
Merge pull request #585 from MITLibraries/sentry-env-var-not-required
Browse files Browse the repository at this point in the history
Remove SENTRY_DSN from required env vars
  • Loading branch information
ghukill authored Dec 13, 2024
2 parents ff749b6 + 58d8f0b commit 347de17
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ WORKSPACE=dev
RECORD_SKIP_LIST=<oai-pmh-id1> <oai-pmh-id2>

# Sets the interval for logging status updates as records are written to the output file. Defaults to 1000, which will log a status update for every thousandth record.
STATUS_UPDATE_INTERVAL = 1000
STATUS_UPDATE_INTERVAL=1000

# If set to a valid Sentry DSN, enables Sentry exception monitoring This is not needed for local development.
SENTRY_DSN = <sentry-dsn-for-oai-pmh-harvester>
# If set to a valid Sentry DSN, enables Sentry exception monitoring. This can also be set to 'none'.
SENTRY_DSN=<sentry-dsn-for-oai-pmh-harvester>
```

## CLI commands
Expand Down
4 changes: 2 additions & 2 deletions harvester/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@


class Config:
REQUIRED_ENV_VARS = ("WORKSPACE", "SENTRY_DSN")
OPTIONAL_ENV_VARS = ("RECORD_SKIP_LIST", "STATUS_UPDATE_INTERVAL")
REQUIRED_ENV_VARS = ("WORKSPACE",)
OPTIONAL_ENV_VARS = ("RECORD_SKIP_LIST", "SENTRY_DSN", "STATUS_UPDATE_INTERVAL")

def __init__(self, logger: logging.Logger | None = None):
"""Set root logger as default when creating class instance."""
Expand Down
8 changes: 0 additions & 8 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@ def test_config_check_required_env_vars_success(config):
config.check_required_env_vars()


def test_config_check_required_env_vars_error(config, monkeypatch):
monkeypatch.delenv("SENTRY_DSN")
with pytest.raises(
OSError, match="Missing required environment variables: SENTRY_DSN"
):
config.check_required_env_vars()


def test_config_env_var_access_success(config):
assert config.STATUS_UPDATE_INTERVAL == "1000"

Expand Down

0 comments on commit 347de17

Please sign in to comment.