Skip to content

Commit

Permalink
馃
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Apr 11, 2023
1 parent d5ac44b commit 377b7f3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/dexa-mfm/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import pkg from '../package.json'

export interface Env {
DEXA_API_BASE_URL: string
ENVIRONMENT: string
}

const router = OpenAPIRouter({
Expand Down
2 changes: 1 addition & 1 deletion examples/dexa-mfm/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class DexaSearch extends OpenAPIRoute {
return new Response('invalid source IP', { status: 500 })
}

if (!isValidChatGPTIPAddress(ip)) {
if (env.environment === 'production' && !isValidChatGPTIPAddress(ip)) {
// console.warn('search error invalid IP address', ip)
return new Response(`Forbidden`, { status: 403 })
}
Expand Down
8 changes: 7 additions & 1 deletion examples/dexa-mfm/wrangler.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ main = "src/index.ts"
compatibility_date = "2023-04-04"

[vars]
DEXA_API_BASE_URL="TODO"
vars = { DEXA_API_BASE_URL="TODO", ENVIRONMENT="dev" }

[env.staging]
vars = { DEXA_API_BASE_URL="TODO", ENVIRONMENT = "staging" }

[env.production]
vars = { DEXA_API_BASE_URL="TODO", ENVIRONMENT = "production" }

0 comments on commit 377b7f3

Please sign in to comment.