Skip to content

Commit

Permalink
fix yamlfile
Browse files Browse the repository at this point in the history
change env in use server

cookie sameSite

change env path in docker-compose
  • Loading branch information
chickzilla committed Nov 1, 2024
1 parent 531a48b commit 2da1665
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 50 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ dist
.gitignore
docker-compose.yml
**/.next
**/.env
**/.env
**/.env.local
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ INTANIA_AUTH_APP_ID=
INTANIA_AUTH_SECRET=
INTANIA_AUTH_REDIRECT_URL=

JWT_SECRET=
JWT_SECRET=

NEXT_PUBLIC_NODE_ENV=
9 changes: 0 additions & 9 deletions .github/workflows/build-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ on:

env:
IMAGE_NAME: ${{ github.repository }}-web
#NEXT_PUBLIC_API_SERVER_URL: ${{ secrets.NEXT_PUBLIC_API_SERVER_URL }}
#INTANIA_AUTH_APP_ID: ${{ secrets.INTANIA_AUTH_APP_ID }}
#INTANIA_AUTH_REDIRECT_URL: ${{ secrets.INTANIA_AUTH_REDIRECT_URL }}
#JWT_SECRET: ${{ secrets.JWT_SECRET }}

jobs:
build:
Expand Down Expand Up @@ -56,11 +52,6 @@ jobs:
echo "tags = $RESULT"
echo "tags=$RESULT" >> "$GITHUB_OUTPUT"
#- name: Create env File
# run: |
# touch .env
# echo NEXT_PUBLIC_API_SERVER_URL=${{ secrets.NEXT_PUBLIC_API_SERVER_URL }} >> .env

- name: Build Docker image with multiple tags
run: |
tags="${{ steps.tags.outputs.tags }}"
Expand Down
5 changes: 0 additions & 5 deletions apps/web/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ export default function Page() {
ครบจบทุกกระบวนการ มาเริ่มต้นเอกสารกัน !
</h2>
</div>
<p>
debugs: {env('NEXT_PUBLIC_API_SERVER_URL')}{' '}
{env('INTANIA_AUTH_REDIRECT_URL')} {env('INTANIA_AUTH_APP_ID')}{' '}
{env('JWT_SECRET')} {env('INTANIA_AUTH_SECRET')}
</p>
<Button
className="rounded-[80px] bg-gradient-red text-2xl font-bold px-12 py-[10px] h-16"
asChild
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const trpc = createTRPCProxyClient<AppRouter>({
links: [
loggerLink({
enabled: (opts) =>
(env('NODE_ENV') === 'development' && typeof window !== 'undefined') ||
(env('NEXT_PUBLIC_NODE_ENV') === 'development' && typeof window !== 'undefined') ||
(opts.direction === 'down' && opts.result instanceof Error),
}),
httpBatchLink({
Expand Down
7 changes: 3 additions & 4 deletions apps/web/src/service/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { cookies } from 'next/headers';
import { trpc } from '../app/trpc';
import type { Payload, Tokens } from '../interface/auth';
import { authErrors } from '../errors/auth';
import { env } from 'next-runtime-env';

export async function getCookies(): Promise<Tokens> {
try {
Expand All @@ -28,20 +27,20 @@ export async function getCookies(): Promise<Tokens> {
}

export async function signIn(token: string): Promise<Tokens> {
console.log(
/* console.log(
'Nextjs server-side, Signing in with token:',
JSON.stringify({ token }),
'destination:',
env('NEXT_PUBLIC_API_SERVER_URL'),
'auth/signin',
);
); */

// const data = await trpc.authRouter.signin.mutate({ token }).catch((err) => {
// console.error('Nextjs server-side, signIn err:', err);
// throw new Error(authErrors.signInError);
// });
const response = await fetch(
`${env('NEXT_PUBLIC_API_SERVER_URL')}/auth/signin`,
`${process.env.NEXT_PUBLIC_API_SERVER_URL}/auth/signin`,
{
method: 'POST',
headers: {
Expand Down
184 changes: 157 additions & 27 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"INTANIA_AUTH_APP_ID",
"INTANIA_AUTH_REDIRECT_URL",
"JWT_SECRET",
"NODE_ENV"
"NEXT_PUBLIC_NODE_ENV"
],
"globalDependencies": ["**/.env.*local"],
"tasks": {
Expand All @@ -16,7 +16,7 @@
"INTANIA_AUTH_APP_ID",
"INTANIA_AUTH_REDIRECT_URL",
"JWT_SECRET",
"NODE_ENV"
"NEXT_PUBLIC_NODE_ENV"
],
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
Expand Down

0 comments on commit 2da1665

Please sign in to comment.