Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(engine): Split runner url into private/public env vars #135

Merged
merged 1 commit into from
May 9, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ TRACECAT__API_URL=http://api:8000
# Runner Service URL
# We recommend using ngrok here, but feel free to use any other service
# Run `ngrok http --domain=INSERT_STATIC_NGROK_DOMAIN_HERE 8001` to start ngrok and get the forwarding URL
TRACECAT__RUNNER_URL=https://your-ngrok-runner-url
TRACECAT__RUNNER_URL=http://runner:8000
TRACECAT__PUBLIC_RUNNER_URL=https://your-ngrok-runner-url

# --- RabbitMQ ---
RABBITMQ_DEFAULT_PASS=guest
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ services:
TRACECAT__SIGNING_SECRET: ${TRACECAT__SIGNING_SECRET}
TRACECAT__API_URL: ${TRACECAT__API_URL}
TRACECAT__RUNNER_URL: ${TRACECAT__RUNNER_URL}
TRACECAT__PUBLIC_RUNNER_URL: ${TRACECAT__PUBLIC_RUNNER_URL}
# Auth
CLERK_FRONTEND_API_URL: ${CLERK_FRONTEND_API_URL}
TRACECAT__DISABLE_AUTH: ${TRACECAT__DISABLE_AUTH}
Expand Down Expand Up @@ -52,6 +53,7 @@ services:
TRACECAT__SIGNING_SECRET: ${TRACECAT__SIGNING_SECRET}
TRACECAT__API_URL: ${TRACECAT__API_URL}
TRACECAT__RUNNER_URL: ${TRACECAT__RUNNER_URL}
TRACECAT__PUBLIC_RUNNER_URL: ${TRACECAT__PUBLIC_RUNNER_URL}
# Integrations
OPENAI_API_KEY: ${OPENAI_API_KEY}
RESEND_API_KEY: ${RESEND_API_KEY}
Expand Down
2 changes: 1 addition & 1 deletion env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ cp .env.example .env
dotenv_replace "TRACECAT__SERVICE_KEY" "$service_key" "$env_file"
dotenv_replace "TRACECAT__SIGNING_SECRET" "$signing_secret" "$env_file"
dotenv_replace "TRACECAT__DB_ENCRYPTION_KEY" "$db_fernet_key" "$env_file"
dotenv_replace "TRACECAT__RUNNER_URL" "$runner_url" "$env_file"
dotenv_replace "TRACECAT__PUBLIC_RUNNER_URL" "$runner_url" "$env_file"
dotenv_replace "OPENAI_API_KEY" "$openai_api_key" "$env_file"
dotenv_replace "RESEND_API_KEY" "$resend_api_key" "$env_file"

Expand Down
1 change: 1 addition & 0 deletions tracecat/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
TRACECAT__APP_ENV = os.environ.get("TRACECAT__APP_ENV", "dev")
TRACECAT__API_URL = os.environ.get("TRACECAT__API_URL", "http://api:8000")
TRACECAT__RUNNER_URL = os.environ.get("TRACECAT__RUNNER_URL", "http://runner:8000")
TRACECAT__PUBLIC_RUNNER_URL = os.environ["TRACECAT__PUBLIC_RUNNER_URL"]

TRACECAT__TIMESTAMP_FORMAT = "%Y%m%d%H%M%S"
TRACECAT__TRIAGE_DIR = TRACECAT_DIR / "triage"
Expand Down
4 changes: 2 additions & 2 deletions tracecat/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from tracecat import auth, integrations
from tracecat.config import (
TRACECAT__APP_ENV,
TRACECAT__RUNNER_URL,
TRACECAT__PUBLIC_RUNNER_URL,
TRACECAT_DIR,
)
from tracecat.labels.mitre import get_mitre_tactics_techniques
Expand Down Expand Up @@ -319,7 +319,7 @@ def secret(self) -> str:
@computed_field
@property
def url(self) -> str:
return f"{TRACECAT__RUNNER_URL}/webhook/{self.id}/{self.secret}"
return f"{TRACECAT__PUBLIC_RUNNER_URL}/webhook/{self.id}/{self.secret}"


def create_db_engine() -> Engine:
Expand Down