change url for docker container

This commit is contained in:
smanylov
2025-12-03 21:05:09 +07:00
parent b78a392d11
commit ac2fd7c8e0
5 changed files with 32 additions and 13 deletions
+15 -1
View File
@@ -9,7 +9,21 @@ Open [http://localhost:2999](http://localhost:2999)
## Docker ## Docker
docker-compose down -v --rmi all docker-compose down -v --rmi all
docker-compose up
docker-compose up -d
старт докера для просмотра логов внутри докера
docker-compose up -d --build
обновление сборки
docker-compose down
Open [http://localhost:2998](http://localhost:2998) Open [http://localhost:2998](http://localhost:2998)
docker run -d -p 2998:2999 --name no-copy-frontend no-copy-frontend docker run -d -p 2998:2999 --name no-copy-frontend no-copy-frontend
docker network ls
docker network connect no-copy_app-network no-copy-frontend
docker network inspect no-copy_app-network
+9 -7
View File
@@ -1,12 +1,12 @@
'use server' 'use server'
import { SignupFormSchema, loginFormSchema } from '@/app/lib/definitions'; import {SignupFormSchema, loginFormSchema, localDevelopmentUrl} from '@/app/lib/definitions';
import { createSession, deleteSession, getSessionData } from '@/app/lib/session'; import { createSession, deleteSession, getSessionData } from '@/app/lib/session';
import { redirect } from 'next/navigation'; import { redirect } from 'next/navigation';
const API_BASE_URL = process.env.NODE_ENV === 'development' const API_BASE_URL = process.env.NODE_ENV === 'development'
? 'http://localhost' ? localDevelopmentUrl
: 'http://no-copy-app:8080'; : 'http://no_copy_app:8080';
export async function logout() { export async function logout() {
const token = await getSessionData('token'); const token = await getSessionData('token');
@@ -109,20 +109,22 @@ export async function registration(
} }
}); });
console.log('Status:', response.status);
console.log('Status text:', response.statusText);
if (response.ok) { if (response.ok) {
let parsed = await response.json(); let parsed = await response.json();
await createSession(parsed.token, email); await createSession(parsed.token, email);
} else { } else {
throw new Error(` throw new Error(`
Something went wrong. from server -error-. status: ${response.status}
${API_BASE_URL}/api/auth/register
`); `);
} }
} catch (error) { } catch (error) {
if (error) { if (error) {
const errors: Record<string, string> = {} const errors: Record<string, string> = {}
errors['server'] = `? ${API_BASE_URL}/api/auth/register error-- ${error}` errors['server'] = `Fetch error-> ${error}`
return errors; return errors;
} }
throw error; throw error;
+3 -2
View File
@@ -1,9 +1,10 @@
'use server' 'use server'
import { getSessionData } from '@/app/lib/session'; import { getSessionData } from '@/app/lib/session';
import { localDevelopmentUrl } from '@/app/lib/definitions';
const API_BASE_URL = process.env.NODE_ENV === 'development' const API_BASE_URL = process.env.NODE_ENV === 'development'
? 'http://localhost' ? localDevelopmentUrl
: ''; : 'http://no_copy_app:8080';
const FRUITS_URL = 'https://www.fruityvice.com/api/fruit/'; const FRUITS_URL = 'https://www.fruityvice.com/api/fruit/';
const ALL = 'all'; const ALL = 'all';
+2
View File
@@ -48,3 +48,5 @@ export const loginFormSchema = z
.min(1, { error: 'Password must be not empty' }) .min(1, { error: 'Password must be not empty' })
.trim(), .trim(),
}) })
export const localDevelopmentUrl = 'http://localhost:81';
+1 -1
View File
@@ -11,7 +11,7 @@ export default async function proxy(request: NextRequest) {
const isPublicRoute = publicRoutes.includes(path); const isPublicRoute = publicRoutes.includes(path);
const cookie = (await cookies()).get('session')?.value; const cookie = (await cookies()).get('session')?.value;
console.log("cookie"); console.log("-cookie-");
console.log(!!cookie); console.log(!!cookie);
const session = await decrypt(cookie); const session = await decrypt(cookie);