feat: update environment variables in Dockerfile and env.ts; modify logging in api_middleware and settings router
This commit is contained in:
parent
53dad1e4c1
commit
b643a9778b
4 changed files with 13 additions and 7 deletions
|
|
@ -47,8 +47,8 @@ ENV NEXT_PUBLIC_STRIPE_PUBLIC_KEY=$NEXT_PUBLIC_STRIPE_PUBLIC_KEY
|
||||||
# ENV POSTGRES_PASSWORD=$POSTGRES_PASSWORD
|
# ENV POSTGRES_PASSWORD=$POSTGRES_PASSWORD
|
||||||
# ENV JWT_SECRET="build-time-mock"
|
# ENV JWT_SECRET="build-time-mock"
|
||||||
# ENV BACKENDSERVER_URL="http://backend:1323"
|
# ENV BACKENDSERVER_URL="http://backend:1323"
|
||||||
# ENV STRIPE_SECRET_KEY="mock"
|
ENV STRIPE_SECRET_KEY="mock"
|
||||||
# ENV STRIPE_WEBHOOK_SECRET="mock"
|
ENV STRIPE_WEBHOOK_SECRET="mock"
|
||||||
# ENV FIC_CLIENT_ID="mock"
|
# ENV FIC_CLIENT_ID="mock"
|
||||||
# ENV FIC_ACCESS_TOKEN="mock"
|
# ENV FIC_ACCESS_TOKEN="mock"
|
||||||
# ENV FIC_COMPANY_ID="mock"
|
# ENV FIC_COMPANY_ID="mock"
|
||||||
|
|
|
||||||
|
|
@ -41,5 +41,5 @@ export const env = createEnv({
|
||||||
NEXT_PUBLIC_BASE_URL: process.env.NEXT_PUBLIC_BASE_URL,
|
NEXT_PUBLIC_BASE_URL: process.env.NEXT_PUBLIC_BASE_URL,
|
||||||
NEXT_PUBLIC_STRIPE_PUBLIC_KEY: process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY,
|
NEXT_PUBLIC_STRIPE_PUBLIC_KEY: process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY,
|
||||||
},
|
},
|
||||||
skipValidation: process.env.SKIP_ENV_VALIDATION === "true" || false,
|
skipValidation: process.env.SKIP_ENV_VALIDATION === "1" || false,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import { verifyToken } from "~/server/auth/jwt";
|
||||||
|
|
||||||
export const apisMiddleware = async (req: NextRequest) => {
|
export const apisMiddleware = async (req: NextRequest) => {
|
||||||
const { pathname, searchParams } = req.nextUrl;
|
const { pathname, searchParams } = req.nextUrl;
|
||||||
console.log("APIs Middleware triggered for:", pathname);
|
//console.log("APIs Middleware triggered for:", pathname);
|
||||||
|
|
||||||
// Only handle storage API routes
|
// Only handle storage API routes
|
||||||
if (!pathname.startsWith("/storage-api/")) {
|
if (!pathname.startsWith("/storage-api/")) {
|
||||||
|
|
@ -46,7 +46,7 @@ export const apisMiddleware = async (req: NextRequest) => {
|
||||||
|
|
||||||
const storageUrl = `${env.STORAGE_URL}/${slug}?${params.toString()}`;
|
const storageUrl = `${env.STORAGE_URL}/${slug}?${params.toString()}`;
|
||||||
|
|
||||||
console.log("Proxying to:", storageUrl);
|
//console.log("Proxying to:", storageUrl);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Forward the request to storage API
|
// Forward the request to storage API
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,10 @@ export const settingsRouter = createTRPCRouter({
|
||||||
const { success, failed } = await revalidateMultiple(
|
const { success, failed } = await revalidateMultiple(
|
||||||
annunciOnline.map((cod) => `/annuncio/${cod}`),
|
annunciOnline.map((cod) => `/annuncio/${cod}`),
|
||||||
);
|
);
|
||||||
console.log(`Successfully revalidated pages: ${success.join(", ")}`);
|
//console.log(`Successfully revalidated pages: ${success.join(", ")}`);
|
||||||
|
if (success.length === 0) {
|
||||||
|
console.log("No annunci were revalidated.");
|
||||||
|
}
|
||||||
if (failed.length > 0) {
|
if (failed.length > 0) {
|
||||||
failed.forEach(({ path, error }) => {
|
failed.forEach(({ path, error }) => {
|
||||||
console.error(`Failed to revalidate ${path}: ${error}`);
|
console.error(`Failed to revalidate ${path}: ${error}`);
|
||||||
|
|
@ -317,7 +320,10 @@ export const settingsRouter = createTRPCRouter({
|
||||||
const { success, failed } = await revalidateMultiple(
|
const { success, failed } = await revalidateMultiple(
|
||||||
annunciOnline.map((cod) => `/annuncio/${cod}`),
|
annunciOnline.map((cod) => `/annuncio/${cod}`),
|
||||||
);
|
);
|
||||||
console.log(`Successfully revalidated pages: ${success.join(", ")}`);
|
if (success.length === 0) {
|
||||||
|
console.log("No annunci were revalidated.");
|
||||||
|
}
|
||||||
|
//console.log(`Successfully revalidated pages: ${success.join(", ")}`);
|
||||||
if (failed.length > 0) {
|
if (failed.length > 0) {
|
||||||
failed.forEach(({ path, error }) => {
|
failed.forEach(({ path, error }) => {
|
||||||
console.error(`Failed to revalidate ${path}: ${error}`);
|
console.error(`Failed to revalidate ${path}: ${error}`);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue