Skip to content

Commit

Permalink
feat: update env vars
Browse files Browse the repository at this point in the history
Signed-off-by: Roy Scheeren <[email protected]>
  • Loading branch information
royscheeren committed Jul 29, 2024
1 parent 2feef12 commit b90cef9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 77 deletions.
4 changes: 2 additions & 2 deletions packages/oidc-bridge/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ app.post('/signin', async (req, res) => {
} catch (e) {
console.log(e)
return res.redirect(
`${process.env.CLIENT_URL}/signin?error=${encodeURIComponent('An error occurred while trying to sign you in')}`,
`${process.env.OIDC_PROVIDER_CLIENT_URL}/signin?error=${encodeURIComponent('An error occurred while trying to sign you in')}`,
)
}
})
Expand Down Expand Up @@ -129,7 +129,7 @@ app.get('/consent', async (req, res) => {
} catch (e) {
console.log(e)
return res.redirect(
`${process.env.CLIENT_URL}/signin?error=${encodeURIComponent('An error occurred while trying to sign you in')}`,
`${process.env.OIDC_PROVIDER_CLIENT_URL}/signin?error=${encodeURIComponent('An error occurred while trying to sign you in')}`,
)
}
})
Expand Down
6 changes: 4 additions & 2 deletions packages/oidc-client/src/sst-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/// <reference types="vite/client" />
interface ImportMetaEnv {}
interface ImportMetaEnv {
readonly VITE_API_URL: string
}
interface ImportMeta {
readonly env: ImportMetaEnv
}
}
4 changes: 3 additions & 1 deletion packages/oidc-client/stacks/OIDCClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export function OIDCClient({ stack }: StackContext) {
path: './',
buildOutput: '../../dist/packages/oidc-client',
buildCommand: 'cd ../../ && npx nx build oidc-client --prod',
environment: {},
environment: {
VITE_API_URL: process.env.VITE_API_URL || 'https://api.signin.siwt.xyz',
},
customDomain: {
domainName: 'signin.siwt.xyz',
cdk: {
Expand Down
43 changes: 0 additions & 43 deletions packages/siwt.xyz/middleware.bak.ts

This file was deleted.

4 changes: 4 additions & 0 deletions packages/siwt.xyz/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export const authOptions: NextAuthOptions = {
],
callbacks: {
async session({ session, token }) {
if (!(session?.user)) {
return session
}

session.user = {
...session.user,
name: token.sub,
Expand Down
4 changes: 4 additions & 0 deletions packages/siwt.xyz/stacks/siwt.xyz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export default function siwtxyz({ stack }: StackContext) {
ENV: process.env.ENV!,
NEXTAUTH_URL: process.env.NEXTAUTH_URL!,
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET!,
NEXT_AUTH_OIDC_ADMIN_URL: process.env.NEXT_AUTH_OIDC_ADMIN_URL!,
NEXT_PUBLIC_NEXT_AUTH_CLIENT_ID: process.env.NEXT_PUBLIC_NEXT_AUTH_CLIENT_ID!,
NEXT_AUTH_CLIENT_SECRET: process.env.NEXT_AUTH_CLIENT_SECRET!,
NEXT_PUBLIC_DAPP_URL: process.env.NEXT_PUBLIC_DAPP_URL!,
},
})

Expand Down
29 changes: 0 additions & 29 deletions packages/siwt.xyz/webpack.server.config.js

This file was deleted.

0 comments on commit b90cef9

Please sign in to comment.