diff --git a/README.md b/README.md index 9030701..f9b2ae2 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ services: - '3000:3000' environment: API_BASE_URL: http://localhost:3000 + DEFAULT_ACTIONS_RESULTS_URL: https://results-receiver.actions.githubusercontent.com STORAGE_DRIVER: filesystem STORAGE_FILESYSTEM_PATH: /data/cache DB_DRIVER: sqlite diff --git a/lib/schemas.ts b/lib/schemas.ts index ef6e6fb..08cf864 100644 --- a/lib/schemas.ts +++ b/lib/schemas.ts @@ -57,6 +57,8 @@ export const envDbDriverSchema = type.or( export const envBaseSchema = type({ 'API_BASE_URL': 'string.url', + 'DEFAULT_ACTIONS_RESULTS_URL': + "string.url = 'https://results-receiver.actions.githubusercontent.com'", 'CACHE_CLEANUP_OLDER_THAN_DAYS': 'number = 90', 'DISABLE_CLEANUP_JOBS?': 'boolean', 'DEBUG?': 'boolean', diff --git a/routes/[...path].ts b/routes/[...path].ts index 4404f9b..1806232 100644 --- a/routes/[...path].ts +++ b/routes/[...path].ts @@ -1,8 +1,7 @@ +import { env } from '~/lib/env' import { logger } from '~/lib/logger' -const DEFAULT_ACTIONS_RESULTS_URL = 'https://results-receiver.actions.githubusercontent.com' - export default defineEventHandler(async (event) => { - logger.debug('proxying unknown path', event.path, 'to', DEFAULT_ACTIONS_RESULTS_URL) - return proxyRequest(event, `${DEFAULT_ACTIONS_RESULTS_URL}${event.path}`) + logger.debug('proxying unknown path', event.path, 'to', env.DEFAULT_ACTIONS_RESULTS_URL) + return proxyRequest(event, `${env.DEFAULT_ACTIONS_RESULTS_URL}${event.path}`) }) diff --git a/tests/setup.ts b/tests/setup.ts index 447d24a..74e9547 100644 --- a/tests/setup.ts +++ b/tests/setup.ts @@ -26,6 +26,7 @@ const env = createEnv({ const TESTING_ENV_BASE = { API_BASE_URL: 'http://localhost:3000', + DEFAULT_ACTIONS_RESULTS_URL: 'https://results-receiver.actions.xxxxxx.ghe.com', RUNNER_TEMP: path.join(TEST_TEMP_DIR, 'runner-temp'), ACTIONS_RESULTS_URL: 'http://localhost:3000/', ACTIONS_CACHE_URL: 'http://localhost:3000/',