Skip to content

Commit

Permalink
refactor: Drop duplicated env vars (public runner url)
Browse files Browse the repository at this point in the history
  • Loading branch information
topher-lo committed Dec 9, 2024
1 parent 9f50a73 commit 79be76d
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 21 deletions.
7 changes: 3 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,17 @@ TRACECAT__SIGNING_SECRET=your-tracecat-signing-secret
TRACECAT__API_URL=${INTERNAL_API_URL}
# Root path to deal with extra path prefix behind the reverse proxy
TRACECAT__API_ROOT_PATH=/api
# Public Runner URL
# This the public URL for the frontend
TRACECAT__PUBLIC_APP_URL=${PUBLIC_APP_URL}
# This is the public URL for incoming webhooks
# If you wish to expose your webhooks to the internet, you can use a tunneling service like ngrok.
# If using ngrok, run `ngrok http --domain=INSERT_STATIC_NGROK_DOMAIN_HERE 8001`
# to start ngrok and update this with the forwarding URL
TRACECAT__PUBLIC_RUNNER_URL=${PUBLIC_API_URL}
TRACECAT__PUBLIC_API_URL=${PUBLIC_API_URL}
# CORS (comman separated string of allowed origins)
TRACECAT__ALLOW_ORIGINS=http://localhost:3000,${PUBLIC_APP_URL}
# Postgres SSL model
TRACECAT__DB_SSLMODE=disable
TRACECAT__PUBLIC_APP_URL=${PUBLIC_APP_URL}
TRACECAT__PUBLIC_API_URL=${PUBLIC_API_URL}

# --- Postgres ---
TRACECAT__POSTGRES_USER=postgres
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
TRACECAT__DB_ENCRYPTION_KEY: ${TRACECAT__DB_ENCRYPTION_KEY} # Sensitive
TRACECAT__DB_SSLMODE: ${TRACECAT__DB_SSLMODE}
TRACECAT__DB_URI: ${TRACECAT__DB_URI} # Sensitive
TRACECAT__PUBLIC_RUNNER_URL: ${TRACECAT__PUBLIC_RUNNER_URL}
TRACECAT__PUBLIC_API_URL: ${TRACECAT__PUBLIC_API_URL}
TRACECAT__PUBLIC_APP_URL: ${TRACECAT__PUBLIC_APP_URL}
TRACECAT__SERVICE_KEY: ${TRACECAT__SERVICE_KEY} # Sensitive
TRACECAT__SIGNING_SECRET: ${TRACECAT__SIGNING_SECRET} # Sensitive
Expand Down Expand Up @@ -78,7 +78,7 @@ services:
TRACECAT__DB_ENCRYPTION_KEY: ${TRACECAT__DB_ENCRYPTION_KEY} # Sensitive
TRACECAT__DB_SSLMODE: ${TRACECAT__DB_SSLMODE}
TRACECAT__DB_URI: ${TRACECAT__DB_URI} # Sensitive
TRACECAT__PUBLIC_RUNNER_URL: ${TRACECAT__PUBLIC_RUNNER_URL}
TRACECAT__PUBLIC_API_URL: ${TRACECAT__PUBLIC_API_URL}
TRACECAT__EXECUTOR_URL: ${INTERNAL_EXECUTOR_URL}
TRACECAT__SERVICE_KEY: ${TRACECAT__SERVICE_KEY} # Sensitive
TRACECAT__SIGNING_SECRET: ${TRACECAT__SIGNING_SECRET} # Sensitive
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
TRACECAT__DB_ENCRYPTION_KEY: ${TRACECAT__DB_ENCRYPTION_KEY} # Sensitive
TRACECAT__DB_SSLMODE: ${TRACECAT__DB_SSLMODE}
TRACECAT__DB_URI: ${TRACECAT__DB_URI} # Sensitive
TRACECAT__PUBLIC_RUNNER_URL: ${TRACECAT__PUBLIC_RUNNER_URL}
TRACECAT__PUBLIC_API_URL: ${TRACECAT__PUBLIC_API_URL}
TRACECAT__PUBLIC_APP_URL: ${TRACECAT__PUBLIC_APP_URL}
TRACECAT__SERVICE_KEY: ${TRACECAT__SERVICE_KEY} # Sensitive
TRACECAT__SIGNING_SECRET: ${TRACECAT__SIGNING_SECRET} # Sensitive
Expand Down Expand Up @@ -74,7 +74,7 @@ services:
TRACECAT__DB_ENCRYPTION_KEY: ${TRACECAT__DB_ENCRYPTION_KEY} # Sensitive
TRACECAT__DB_SSLMODE: ${TRACECAT__DB_SSLMODE}
TRACECAT__DB_URI: ${TRACECAT__DB_URI} # Sensitive
TRACECAT__PUBLIC_RUNNER_URL: ${TRACECAT__PUBLIC_RUNNER_URL}
TRACECAT__PUBLIC_API_URL: ${TRACECAT__PUBLIC_API_URL}
TRACECAT__EXECUTOR_URL: ${INTERNAL_EXECUTOR_URL}
TRACECAT__SERVICE_KEY: ${TRACECAT__SERVICE_KEY} # Sensitive
TRACECAT__SIGNING_SECRET: ${TRACECAT__SIGNING_SECRET} # Sensitive
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def env_sandbox(monkeysession: pytest.MonkeyPatch):
# Needed for local unit tests
monkeysession.setenv("TRACECAT__EXECUTOR_URL", "http://executor:8000")
monkeysession.setenv("TRACECAT__PUBLIC_API_URL", "http://localhost/api")
monkeysession.setenv("TRACECAT__PUBLIC_RUNNER_URL", "http://localhost:8001")
monkeysession.setenv("TRACECAT__SERVICE_KEY", os.environ["TRACECAT__SERVICE_KEY"])
monkeysession.setenv("TRACECAT__SIGNING_SECRET", "test-signing-secret")
# When launching the worker directly in a test, use localhost
Expand Down
11 changes: 0 additions & 11 deletions tracecat/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,12 @@

from tracecat.auth.constants import AuthType

# === Actions Config === #
HTTP_MAX_RETRIES = 10
LLM_MAX_RETRIES = 3

# === Internal Services === #
TRACECAT__SCHEDULE_INTERVAL_SECONDS = os.environ.get(
"TRACECAT__SCHEDULE_INTERVAL_SECONDS", 60
)
TRACECAT__SCHEDULE_MAX_CONNECTIONS = 6
TRACECAT__APP_ENV: Literal["development", "staging", "production"] = os.environ.get(
"TRACECAT__APP_ENV", "development"
) # type: ignore
TRACECAT__API_URL = os.environ.get("TRACECAT__API_URL", "http://localhost:8000")
TRACECAT__API_ROOT_PATH = os.environ.get("TRACECAT__API_ROOT_PATH", "/api")
TRACECAT__PUBLIC_RUNNER_URL = os.environ.get(
"TRACECAT__PUBLIC_RUNNER_URL", "http://localhost/api"
)
TRACECAT__PUBLIC_API_URL = os.environ.get(
"TRACECAT__PUBLIC_API_URL", "http://localhost/api"
)
Expand Down
2 changes: 1 addition & 1 deletion tracecat/db/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def secret(self) -> str:
@computed_field
@property
def url(self) -> str:
return f"{config.TRACECAT__PUBLIC_RUNNER_URL}/webhooks/{self.workflow_id}/{self.secret}"
return f"{config.TRACECAT__PUBLIC_API_URL}/webhooks/{self.workflow_id}/{self.secret}"


class Schedule(Resource, table=True):
Expand Down

0 comments on commit 79be76d

Please sign in to comment.