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
5 changes: 0 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ BETTER_AUTH_URL=http://localhost:3000
# Optional comma-separated list of additional trusted origins for Better Auth.
# Example: BETTER_AUTH_TRUSTED_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
# BETTER_AUTH_TRUSTED_ORIGINS=
# On Railway production environments:
# - Set BETTER_AUTH_URL to your primary public origin, for example https://finance.example.com
# - Set BETTER_AUTH_TRUSTED_ORIGINS to every live auth origin, for example
# https://app.example.com,https://app-production-1234.up.railway.app
# - Do not include localhost origins in Railway production variables

# Optional agent request limit overrides.
# Safe defaults are enabled in code even when these remain commented out.
Expand Down
11 changes: 0 additions & 11 deletions railway.json

This file was deleted.

32 changes: 0 additions & 32 deletions src/lib/server/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const AUTH_DEFAULT_RATE_LIMIT_MAX_REQUESTS = 100
const AUTH_CREDENTIAL_RATE_LIMIT_WINDOW_SECONDS = 15 * 60
const AUTH_CREDENTIAL_RATE_LIMIT_MAX_REQUESTS = 5
const THIRTY_DAYS_IN_SECONDS = 60 * 60 * 24 * 30
const RAILWAY_URL_ENV_NAME_PATTERN = /^RAILWAY_SERVICE_.+_URL$/
const VERCEL_ENV = "VERCEL_ENV" as const
const VERCEL_BRANCH_URL_ENV = "VERCEL_BRANCH_URL" as const
const VERCEL_URL_ENV = "VERCEL_URL" as const
Expand Down Expand Up @@ -146,10 +145,6 @@ function getTrustedOrigins(baseUrl: string): string[] {
}
}

for (const origin of getRailwayOrigins()) {
trustedOrigins.add(origin)
}

return [...trustedOrigins]
}

Expand All @@ -171,33 +166,6 @@ function normalizeOrigin(value: string): string | null {
}
}

function getRailwayOrigins(): string[] {
const railwayOriginCandidates = Object.entries(process.env)
.filter(
([name, value]) =>
Boolean(value) &&
(name === "RAILWAY_PUBLIC_DOMAIN" ||
name === "RAILWAY_STATIC_URL" ||
RAILWAY_URL_ENV_NAME_PATTERN.test(name))
)
.map(([, value]) => value)

const railwayOrigins = new Set<string>()

for (const originCandidate of railwayOriginCandidates) {
if (!originCandidate) {
continue
}

const normalizedOrigin = normalizeOrigin(originCandidate)
if (normalizedOrigin) {
railwayOrigins.add(normalizedOrigin)
}
}

return [...railwayOrigins]
}

function getAllowedHosts(trustedOrigins: string[]): string[] {
const allowedHosts = new Set<string>()

Expand Down
Loading