Skip to content
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 @@ -85,7 +85,7 @@ configuration file can be specified with the `--config` (`-c`) option.
It contains 6 main sections:

- `pulse` holds the exchange configuration (can be overridden by environment, see below)
- `sentry` contains the `sentry_dsn` for monitoring
- `sentry` contains the `dsn` for monitoring
- `clones` allows to set the `directory` in which local work clones will be created
- `tracked_repositories` provides `name` and source `url` for Git repos to track
- `branch_mappings` describes which Git repo and branches should be synced to which Hg repo
Expand Down
2 changes: 1 addition & 1 deletion config-development.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ heartbeat = 30
queue = "queue/githgsyncdev/pushes"

[sentry]
sentry_dsn = ""
dsn = ""

[clones]
directory = "/clones"
Expand Down
2 changes: 1 addition & 1 deletion config-docker.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ heartbeat = 30
ssl = false

[sentry]
sentry_dsn = ""
dsn = ""

[clones]
directory = "/clones"
Expand Down
2 changes: 1 addition & 1 deletion config-production.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ routing_key = ""
queue = ""

[sentry]
sentry_dsn = ""
dsn = ""

[clones]
directory = "/clones"
Expand Down
2 changes: 1 addition & 1 deletion config-staging.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ heartbeat = 30
queue = "queue/githgsyncstage/pushes"

[sentry]
sentry_dsn = ""
dsn = ""

[clones]
directory = "/clones"
Expand Down
2 changes: 1 addition & 1 deletion config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ heartbeat = 30
ssl = true

[sentry]
sentry_dsn = ""
dsn = ""

[clones]
directory = "../git_hg_sync_repos/"
Expand Down
6 changes: 3 additions & 3 deletions git_hg_sync/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def main() -> None:
sys.exit(1)

sentry_config = config.sentry
if sentry_config and sentry_config.sentry_dsn:
logger.info(f"Sentry DSN: {sentry_config.sentry_dsn}")
sentry_sdk.init(sentry_config.sentry_dsn, max_value_length=4096)
if sentry_config and sentry_config.dsn:
logger.info(f"Sentry DSN: {sentry_config.dsn}")
sentry_sdk.init(sentry_config.dsn, max_value_length=4096)
start_app(config, logger)


Expand Down
4 changes: 1 addition & 3 deletions git_hg_sync/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from mozlog import get_proxy_logger
from pydantic import (
AfterValidator,
AliasChoices,
Field,
ValidationInfo,
model_validator,
)
Expand Down Expand Up @@ -57,7 +55,7 @@ class ClonesConfig(BaseSettings):


class SentryConfig(BaseSettings):
sentry_dsn: Annotated[str, Field(alias=AliasChoices("sentry_dsn", "dsn"))] = ""
dsn: str = ""


class Config(BaseSettings):
Expand Down
3 changes: 3 additions & 0 deletions tests/data/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ password = "guest"
heartbeat = 30
ssl = false

[sentry]
dsn = ""

[clones]
directory = "{directory}/clones"

Expand Down
9 changes: 2 additions & 7 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,13 @@ def test_load_config_env_override(monkeypatch: pytest.MonkeyPatch) -> None:
"heartbeat": "42",
},
"sentry": {
"sentry_dsn": "overridden sentry_dsn",
"dsn": "overridden sentry_dsn",
},
}

no_prefix_sections = ["sentry"]

for section, env in overrides.items():
for var, value in env.items():
if section in no_prefix_sections:
monkeypatch.setenv(f"{var}".upper(), value)
else:
monkeypatch.setenv(f"{section}_{var}".upper(), value)
monkeypatch.setenv(f"{section}_{var}".upper(), value)

config = Config.from_file(HERE / "data" / "config.toml")

Expand Down
Loading