diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cb80245..f22a57b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -16,12 +16,20 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile - # - name: Deploy to production - # if: ${{ github.ref == 'refs/heads/main' }} - # uses: cloudflare/wrangler-action@v3 - # with: - # apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - # accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + - name: Deploy to production + if: ${{ github.ref == 'refs/heads/main' }} + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: deploy --env production + environment: production + secrets: | + DENTITY_CLIENT_SECRET + DENTITY_CLIENT_ID + env: + DENTITY_CLIENT_ID: ${{ secrets.DENTITY_CLIENT_ID }} + DENTITY_CLIENT_SECRET: ${{ secrets.DENTITY_CLIENT_SECRET }} - name: Deploy to staging if: ${{ github.ref != 'refs/heads/main' }} @@ -36,6 +44,4 @@ jobs: DENTITY_CLIENT_ID env: DENTITY_CLIENT_ID: ${{ secrets.DENTITY_STAGING_CLIENT_ID }} - DENTITY_CLIENT_SECRET: ${{ secrets.DENTITY_STAGING_CLIENT_SECRET }} - DENTITY_BASE_ENDPOINT: https://oidc.staging.dentity.com - APP_REDIRCT: https://ens.domains \ No newline at end of file + DENTITY_CLIENT_SECRET: ${{ secrets.DENTITY_STAGING_CLIENT_SECRET }} \ No newline at end of file diff --git a/src/routes/v1/dentity/fetchDentityFederatedToken.ts b/src/routes/v1/dentity/fetchDentityFederatedToken.ts index b185b43..deba2aa 100644 --- a/src/routes/v1/dentity/fetchDentityFederatedToken.ts +++ b/src/routes/v1/dentity/fetchDentityFederatedToken.ts @@ -35,7 +35,7 @@ export const fetchDentityFederatedToken = async ( const { federated_token, ens_name, error: errorTitle, error_description, ...rest} = data as DentityFederatedTokenResponse - if (!federated_token || !ens_name) return error(400, {error : errorTitle, error_description, DENTITY_CLIENT_ID, code, APP_REDIRECT}) + if (!federated_token || !ens_name) return error(400, {error : errorTitle, error_description}) const url = new URL(`${DENTITY_BASE_ENDPOINT}/oidc/vp-token`) url.searchParams.append('federated_token', federated_token) @@ -44,9 +44,5 @@ export const fetchDentityFederatedToken = async ( return json({ name: ens_name, verifiedPresentationUri: url.toString(), - DENTITY_BASE_ENDPOINT, - ...rest, - ens_name, - federated_token }) } diff --git a/wrangler.toml b/wrangler.toml index 0832e87..9742709 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -2,6 +2,12 @@ name = "auth-worker" main = "src/index.ts" compatibility_date = "2024-02-23" +[env.production] +name = "auth-worker" + +[env.production.vars] +DENTITY_BASE_ENDPOINT = "https://oidc.dentity.com" +APP_REDIRECT = "https://ens.domains" [env.staging] name = "auth-worker-staging"