Skip to content
Snippets Groups Projects
Verified Commit a448945a authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

Add public hostname and environment to general OSS params

parent af334eed
No related branches found
No related tags found
1 merge request!245Feature/distinguish public private hostname
...@@ -47,8 +47,8 @@ def init_cli_app() -> typer.Typer: ...@@ -47,8 +47,8 @@ def init_cli_app() -> typer.Typer:
def init_sentry() -> None: def init_sentry() -> None:
"""Only initialize Sentry if not in testing mode.""" """Only initialize Sentry if not in testing mode."""
if os.getenv("TESTING", "false").lower() == "false" and (sentry_config := load_oss_params().SENTRY): if os.getenv("TESTING", "false").lower() == "false" and (oss_params := load_oss_params()):
sentry_sdk.init(dsn=sentry_config.DSN, environment=sentry_config.environment, traces_sample_rate=1.0) sentry_sdk.init(dsn=oss_params.SENTRY.DSN, environment=oss_params.GENERAL.environment, traces_sample_rate=1.0)
init_sentry() init_sentry()
{ {
"GENERAL": { "GENERAL": {
"public_hostname": "https://gap.geant.org", "public_hostname": "https://gap.geant.org",
"isis_high_metric": 999999 "internal_hostname": "http://gso-api:9000",
"isis_high_metric": 999999,
"environment": "development"
}, },
"NETBOX": { "NETBOX": {
"api": "https://127.0.0.1:8000", "api": "https://127.0.0.1:8000",
...@@ -119,7 +121,6 @@ ...@@ -119,7 +121,6 @@
"md5_password": "snmp password" "md5_password": "snmp password"
}, },
"SENTRY": { "SENTRY": {
"DSN": "https://sentry-dsn-url", "DSN": "https://sentry-dsn-url"
"environment": "development"
} }
} }
...@@ -21,13 +21,24 @@ from gso.utils.shared_enums import PortNumber ...@@ -21,13 +21,24 @@ from gso.utils.shared_enums import PortNumber
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class EnvironmentEnum(strEnum):
"""The different environments in which the GSO system can run."""
DEVELOPMENT = "development"
TEST = "test"
UAT = "uat"
PRODUCTION = "production"
class GeneralParams(BaseSettings): class GeneralParams(BaseSettings):
"""General parameters for a :term:`GSO` configuration file.""" """General parameters for a :term:`GSO` configuration file."""
public_hostname: str public_hostname: str
"""The hostname that :term:`GSO` is publicly served at, used for building the callback URL that the provisioning """The hostname that :term:`GSO` is publicly served at, used for building callback URLs for public use."""
proxy uses.""" internal_hostname: str
"""The hostname of :term:`GSO` that is for internal use, such as the provisioning proxy."""
isis_high_metric: int isis_high_metric: int
environment: EnvironmentEnum
class CeleryParams(BaseSettings): class CeleryParams(BaseSettings):
...@@ -192,20 +203,10 @@ class KentikParams(BaseSettings): ...@@ -192,20 +203,10 @@ class KentikParams(BaseSettings):
md5_password: str md5_password: str
class EnvironmentEnum(strEnum):
"""The different environments in which the GSO system can run."""
DEVELOPMENT = "development"
TEST = "test"
UAT = "uat"
PRODUCTION = "production"
class SentryParams(BaseSettings): class SentryParams(BaseSettings):
"""Settings for Sentry.""" """Settings for Sentry."""
DSN: str DSN: str
environment: EnvironmentEnum
class OSSParams(BaseSettings): class OSSParams(BaseSettings):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment