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

[IOPLT-699] Update API_KEY var name and OpenAPI url to generate trial system client #1150

Merged
merged 4 commits into from
Oct 1, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,14 @@ SERVICES_APP_BACKEND_API_BASE_PATH="/api/v1"
# ------------------------------------
FF_TRIAL_SYSTEM_ENABLED="1"
TRIAL_SYSTEM_API_BASE_PATH="/api/v1"
TRIAL_SYSTEM_API_URL="https://trial-system"
TRIAL_SYSTEM_API_KEY="put_your_api_key_here"
TRIAL_SYSTEM_APIM_BASE_PATH="/manage/api/v1"
TRIAL_SYSTEM_APIM_URL="https://trial-system"
TRIAL_SYSTEM_APIM_KEY="put_your_api_key_here"

# ------------------------------------
# IO_WALLET
# ------------------------------------
IO_WALLET_API_KEY=put_your_api_key_here
IO_WALLET_API_URL=https://io-wallet
IO_WALLET_API_BASE_PATH="/api/v1"
IO_WALLET_TRIAL_ID=IO_WALLET_TRIAL_ID
IO_WALLET_TRIAL_ID=IO_WALLET_TRIAL_ID
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"generate:messages:notifications": "rimraf generated/messages && gen-api-models --api-spec notification_queue_messages.yaml --out-dir generated/messages",
"generate:proxy:myportal-models": "rimraf generated/myportal && gen-api-models --api-spec api_myportal.yaml --out-dir generated/myportal",
"generate:proxy:trial-system-models": "rimraf generated/trial-system && gen-api-models --api-spec api_trial_system.yaml --out-dir generated/trial-system",
"generate:api:trial-system": "rimraf generated/trial-system-api && gen-api-models --api-spec https://raw.githubusercontent.com/pagopa/trial-system/59d0a1e462bf6dc8aee76ee5526d5cf4a4a73c77/apps/functions-subscription/api/internal.yaml --no-strict --out-dir generated/trial-system-api --request-types --response-decoders --client",
"generate:api:trial-system": "rimraf generated/trial-system-api && gen-api-models --api-spec https://raw.githubusercontent.com/pagopa/trial-system/081d98c37a116c9d842f31c54a2fe641680c5424/infra/resources/modules/commons/api/ts_management/v1/_openapi.yaml --no-strict --out-dir generated/trial-system-api --request-types --response-decoders --client",
"generate:proxy:first-lc-models": "rimraf generated/first-lc-proxy-models && gen-api-models --api-spec api_lollipop_first_consumer.yaml --out-dir generated/first-lc-proxy-models",
"generate:proxy:public-models": "rimraf generated/public && gen-api-models --api-spec api_public.yaml --out-dir generated/public",
"generate:api:io-messages": "rimraf generated/io-messages-api && gen-api-models --api-spec https://raw.githubusercontent.com/pagopa/io-functions-app-messages/v5.3.0/openapi/index.yaml --no-strict --out-dir generated/io-messages-api --request-types --response-decoders --client",
Expand Down
3 changes: 2 additions & 1 deletion src/clients/trial-system.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import { Client, createClient } from "../../generated/trial-system-api/client";
export function TrialSystemAPIClient(
token: string,
baseUrl: string,
basePath: string,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
fetchApi: typeof fetch = nodeFetch as any as typeof fetch
): Client<"ApiKeyAuth"> {
return createClient<"ApiKeyAuth">({
basePath: "",
basePath,
baseUrl,
fetchApi,
withDefaults: (op) => (params) =>
Expand Down
10 changes: 7 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,12 +636,16 @@ export const FF_TRIAL_SYSTEM_ENABLED =
export const TRIAL_SYSTEM_API_BASE_PATH = getRequiredENVVar(
"TRIAL_SYSTEM_API_BASE_PATH"
);
export const TRIAL_SYSTEM_API_KEY = getRequiredENVVar("TRIAL_SYSTEM_API_KEY");
export const TRIAL_SYSTEM_API_URL = getRequiredENVVar("TRIAL_SYSTEM_API_URL");
export const TRIAL_SYSTEM_API_KEY = getRequiredENVVar("TRIAL_SYSTEM_APIM_KEY");
export const TRIAL_SYSTEM_API_URL = getRequiredENVVar("TRIAL_SYSTEM_APIM_URL");
export const TRIAL_SYSTEM_APIM_BASE_PATH = getRequiredENVVar(
"TRIAL_SYSTEM_APIM_BASE_PATH"
);

export const TRIAL_SYSTEM_CLIENT = TrialSystemAPIClient(
TRIAL_SYSTEM_API_KEY,
TRIAL_SYSTEM_API_URL
TRIAL_SYSTEM_API_URL,
TRIAL_SYSTEM_APIM_BASE_PATH
);
export const IO_WALLET_API_KEY = getRequiredENVVar("IO_WALLET_API_KEY");
export const IO_WALLET_API_URL = getRequiredENVVar("IO_WALLET_API_URL");
Expand Down
Loading