refactor .env usage due to unexpexted env values
This commit is contained in:
10
.env
10
.env
@ -1,11 +1,9 @@
|
|||||||
|
|
||||||
#NODE_TLS_REJECT_UNAUTHORIZED='0'
|
#NODE_TLS_REJECT_UNAUTHORIZED='0'
|
||||||
SSL_ENABLED=false
|
# SSL_ENABLED=false
|
||||||
NEXT_PUBLIC_PROTOCOL=https
|
# NEXT_PUBLIC_HOST=localhost
|
||||||
NEXT_PUBLIC_HOST=localhost
|
# NEXT_PUBLIC_PORT=3003
|
||||||
NEXT_PUBLIC_PORT=3003
|
# PUBLIC_URL=http://localhost:3003
|
||||||
NEXTAUTH_URL=https://localhost:3003
|
|
||||||
# NEXTAUTH_URL_INTERNAL=http://127.0.0.1:3003
|
|
||||||
|
|
||||||
# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
|
# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
|
||||||
NEXTAUTH_SECRET=ed8a9681efc414df89dfd03cd188ed58
|
NEXTAUTH_SECRET=ed8a9681efc414df89dfd03cd188ed58
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
NEXT_PUBLIC_PROTOCOL=https
|
SSL_ENABLED=false
|
||||||
NEXT_PUBLIC_PORT=
|
NEXT_PUBLIC_PORT=
|
||||||
NEXT_PUBLIC_HOST=staging.mwhitnessing.com
|
NEXT_PUBLIC_HOST=staging.mwhitnessing.com
|
||||||
NEXTAUTH_URL= https://staging.mwhitnessing.com
|
PUBLIC_URL=https://staging.mwhitnessing.com
|
||||||
|
|
||||||
# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
|
# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
|
||||||
NEXTAUTH_SECRET=1dd8a5457970d1dda50600be28e935ecc4513ff27c49c431849e6746f158d638
|
NEXTAUTH_SECRET=1dd8a5457970d1dda50600be28e935ecc4513ff27c49c431849e6746f158d638
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
NODE_TLS_REJECT_UNAUTHORIZED=0
|
NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||||
# NODE_EXTRA_CA_CERTS=C:\\Users\\popov\\AppData\\Local\\mkcert
|
# NODE_EXTRA_CA_CERTS=C:\\Users\\popov\\AppData\\Local\\mkcert
|
||||||
|
PROTOCOL=https
|
||||||
NEXT_PUBLIC_PROTOCOL=https
|
|
||||||
NEXT_PUBLIC_HOST=localhost
|
NEXT_PUBLIC_HOST=localhost
|
||||||
NEXT_PUBLIC_PORT=3003
|
NEXT_PUBLIC_PORT=3003
|
||||||
NEXTAUTH_URL=https://localhost:3003
|
PUBLIC_URL=https://localhost:3003
|
||||||
|
|
||||||
SSL_ENABLED=true
|
|
||||||
TELEGRAM_BOT=true
|
|
||||||
SSL_KEY=./certificates/localhost-key.pem
|
SSL_KEY=./certificates/localhost-key.pem
|
||||||
SSL_CERT=./certificates/localhost.pem
|
SSL_CERT=./certificates/localhost.pem
|
||||||
|
|
||||||
|
37
.env.homelab
37
.env.homelab
@ -1,37 +0,0 @@
|
|||||||
NODE_TLS_REJECT_UNAUTHORIZED='0'
|
|
||||||
# DATABASE_URL="file:./src/data/dev.db"
|
|
||||||
# DATABASE_URL="mysql://root:Zelen0ku4e@192.168.0.10:3306/cart"
|
|
||||||
|
|
||||||
NEXT_PUBLIC_PORT=
|
|
||||||
# NEXT_PUBLIC_NEXTAUTH_URL=https://cart.d-popov.com
|
|
||||||
NEXT_PUBLIC_PROTOCOL=https
|
|
||||||
NEXT_PUBLIC_HOST=cart.d-popov.com
|
|
||||||
NEXTAUTH_URL=https://cart.d-popov.com
|
|
||||||
# NEXTAUTH_URL= https://demo.mwhitnessing.com
|
|
||||||
|
|
||||||
# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
|
|
||||||
NEXTAUTH_SECRET=ed8a9681efc414df89dfd03cd188ed58
|
|
||||||
DATABASE_URL=mysql://cart:cart2023@192.168.0.10:3306/cart_demo
|
|
||||||
|
|
||||||
APPLE_ID=
|
|
||||||
APPLE_TEAM_ID=
|
|
||||||
APPLE_PRIVATE_KEY=
|
|
||||||
APPLE_KEY_ID=
|
|
||||||
|
|
||||||
AUTH0_ID=Aa9f3HJowauUrmBVY4iQzQJ7fYsaZDbK
|
|
||||||
AUTH0_SECRET=_c0O9GkyRXkoWMQW7jNExnl6UoXN6O4oD3mg7NZ_uHVeAinCUtcTAkeQmcKXpZ4x
|
|
||||||
AUTH0_ISSUER=https://dev-wkzi658ckibr1amv.us.auth0.com
|
|
||||||
|
|
||||||
FACEBOOK_ID=
|
|
||||||
FACEBOOK_SECRET=
|
|
||||||
|
|
||||||
GITHUB_ID=
|
|
||||||
GITHUB_SECRET=
|
|
||||||
# GOOGLE_ID=926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com
|
|
||||||
# GOOGLE_SECRET=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
|
|
||||||
|
|
||||||
TWITTER_ID=
|
|
||||||
TWITTER_SECRET=
|
|
||||||
|
|
||||||
EMAIL_SERVER=smtp://8ec69527ff2104:c7bc05f171c96c@smtp.mailtrap.io:2525
|
|
||||||
EMAIL_FROM=noreply@example.com
|
|
@ -1,7 +1,7 @@
|
|||||||
NEXT_PUBLIC_PROTOCOL=https
|
|
||||||
NEXT_PUBLIC_PORT=
|
NEXT_PUBLIC_PORT=
|
||||||
NEXT_PUBLIC_HOST=sofia.mwhitnessing.com
|
NEXT_PUBLIC_HOST=sofia.mwhitnessing.com
|
||||||
NEXTAUTH_URL= https://sofia.mwhitnessing.com
|
SSL_ENABLED=false # we're behind a reverse proxy. SSL is handled by the proxy
|
||||||
|
PUBLIC_URL= https://sofia.mwhitnessing.com
|
||||||
|
|
||||||
# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
|
# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
|
||||||
NEXTAUTH_SECRET=1dd8a5457970d1dda50600be28e935ecc4513ff27c49c431849e6746f158d638
|
NEXTAUTH_SECRET=1dd8a5457970d1dda50600be28e935ecc4513ff27c49c431849e6746f158d638
|
||||||
|
17
.env.test
17
.env.test
@ -1,13 +1,15 @@
|
|||||||
NODE_TLS_REJECT_UNAUTHORIZED='0'
|
NODE_TLS_REJECT_UNAUTHORIZED='0'
|
||||||
|
# DATABASE_URL="file:./src/data/dev.db"
|
||||||
|
# DATABASE_URL="mysql://root:Zelen0ku4e@192.168.0.10:3306/cart"
|
||||||
|
|
||||||
NEXT_PUBLIC_PORT=5001
|
SSL_ENABLED=true
|
||||||
NEXT_PUBLIC_PROTOCOL=https
|
NEXT_PUBLIC_PORT=
|
||||||
NEXT_PUBLIC_HOST=cart.d-popov.com
|
NEXT_PUBLIC_HOST=cart.d-popov.com
|
||||||
NEXTAUTH_URL=https://cart.d-popov.com
|
PUBLIC_URL=https://cart.d-popov.com
|
||||||
|
|
||||||
# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
|
# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
|
||||||
NEXTAUTH_SECRET=ed8a9681efc414df89dfd03cd188ed58
|
NEXTAUTH_SECRET=ed8a9681efc414df89dfd03cd188ed58
|
||||||
DATABASE_URL=mysql://cart:cartpw@192.168.0.10:3306/cart_dev
|
DATABASE_URL=mysql://cart:cart2023@192.168.0.10:3306/cart_demo
|
||||||
|
|
||||||
APPLE_ID=
|
APPLE_ID=
|
||||||
APPLE_TEAM_ID=
|
APPLE_TEAM_ID=
|
||||||
@ -23,14 +25,11 @@ FACEBOOK_SECRET=
|
|||||||
|
|
||||||
GITHUB_ID=
|
GITHUB_ID=
|
||||||
GITHUB_SECRET=
|
GITHUB_SECRET=
|
||||||
GOOGLE_ID=926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com
|
# GOOGLE_ID=926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com
|
||||||
GOOGLE_SECRET=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
|
# GOOGLE_SECRET=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
|
||||||
|
|
||||||
TWITTER_ID=
|
TWITTER_ID=
|
||||||
TWITTER_SECRET=
|
TWITTER_SECRET=
|
||||||
|
|
||||||
EMAIL_SERVER=smtp://8ec69527ff2104:c7bc05f171c96c@smtp.mailtrap.io:2525
|
EMAIL_SERVER=smtp://8ec69527ff2104:c7bc05f171c96c@smtp.mailtrap.io:2525
|
||||||
EMAIL_FROM=noreply@example.com
|
EMAIL_FROM=noreply@example.com
|
||||||
|
|
||||||
GMAIL_EMAIL_USERNAME=
|
|
||||||
GMAIL_EMAIL_APP_PASS=
|
|
||||||
|
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@ -6,7 +6,7 @@
|
|||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "Run npm nodemon (DEV)",
|
"name": "Run npm nodemon (DEV)",
|
||||||
"command": "npm run debug-env",
|
"command": "npm run debug",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "node-terminal",
|
"type": "node-terminal",
|
||||||
"preLaunchTask": "killInspector",
|
"preLaunchTask": "killInspector",
|
||||||
@ -35,7 +35,7 @@
|
|||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "node-terminal",
|
"type": "node-terminal",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"command": "conda activate node && npm run debug-env",
|
"command": "conda activate node && npm run debug",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Run conda npm TEST",
|
"name": "Run conda npm TEST",
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"homepage": "https://git.d-popov.com/popov/next-cart-app",
|
"homepage": "https://git.d-popov.com/popov/next-cart-app",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"debug": "nodemon --inspect server.js",
|
"debug": "nodemon --inspect server.js",
|
||||||
"debug-env": "cross-env NODE_ENV=development dotenv -e .env.development -- nodemon --inspect server.js",
|
"debug-env-dev": "dotenv -e .env.development -- nodemon --inspect server.js",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"buildWin": "npm run build",
|
"buildWin": "npm run build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
|
@ -24,7 +24,7 @@ import { isLoggedIn, setAuthTokens, clearAuthTokens, getAccessToken, getRefreshT
|
|||||||
export const authOptions: NextAuthOptions = {
|
export const authOptions: NextAuthOptions = {
|
||||||
// https://next-auth.js.org/configuration/providers/oauth
|
// https://next-auth.js.org/configuration/providers/oauth
|
||||||
|
|
||||||
site: process.env.NEXTAUTH_URL,
|
site: process.env.PUBLIC_URL,
|
||||||
secret: process.env.NEXTAUTH_SECRET, // Ensure you have this set in your .env file
|
secret: process.env.NEXTAUTH_SECRET, // Ensure you have this set in your .env file
|
||||||
//adapter: PrismaAdapter(prisma),
|
//adapter: PrismaAdapter(prisma),
|
||||||
providers: [
|
providers: [
|
||||||
|
@ -444,7 +444,7 @@ async function GenerateSchedule(axios: Axios, date: string, copyFromPreviousMont
|
|||||||
}
|
}
|
||||||
|
|
||||||
//create shifts using API
|
//create shifts using API
|
||||||
// const { data: createdShifts } = await axios.post(`${process.env.NEXTAUTH_URL}/api/data/shifts`, shiftsToCreate);
|
// const { data: createdShifts } = await axios.post(`${process.env.PUBLIC_URL}/api/data/shifts`, shiftsToCreate);
|
||||||
//const { data: allshifts } = await axios.get(`/api/data/shifts`);
|
//const { data: allshifts } = await axios.get(`/api/data/shifts`);
|
||||||
return {}; //allshifts;
|
return {}; //allshifts;
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ export const getServerSideProps = async (context) => {
|
|||||||
|
|
||||||
const role = session?.user.role;
|
const role = session?.user.role;
|
||||||
console.log("server role: " + role);
|
console.log("server role: " + role);
|
||||||
var queryUrl = process.env.NEXTAUTH_URL + "/api/data/availabilities?select=id,name,isActive,dayofweek,dayOfMonth,startTime,endTime,publisher.firstName,publisher.lastName,publisher.id";
|
var queryUrl = process.env.PUBLIC_URL + "/api/data/availabilities?select=id,name,isActive,dayofweek,dayOfMonth,startTime,endTime,publisher.firstName,publisher.lastName,publisher.id";
|
||||||
if (role === UserRole.USER || context.query.my) {
|
if (role === UserRole.USER || context.query.my) {
|
||||||
queryUrl += `&where={"publisherId":"${session?.user.id}"}`;
|
queryUrl += `&where={"publisherId":"${session?.user.id}"}`;
|
||||||
} else if (role == UserRole.ADMIN) {
|
} else if (role == UserRole.ADMIN) {
|
||||||
@ -145,7 +145,7 @@ export const getServerSideProps = async (context) => {
|
|||||||
}
|
}
|
||||||
var resp = await axios.get(
|
var resp = await axios.get(
|
||||||
queryUrl
|
queryUrl
|
||||||
// process.env.NEXTAUTH_URL + "/api/data/availabilities?include=publisher",
|
// process.env.PUBLIC_URL + "/api/data/availabilities?include=publisher",
|
||||||
, { decompress: true });
|
, { decompress: true });
|
||||||
var items = resp.data;
|
var items = resp.data;
|
||||||
console.log("got " + items.length + " availabilities");
|
console.log("got " + items.length + " availabilities");
|
||||||
|
@ -31,7 +31,7 @@ export const getServerSideProps = async (context) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
const { data: item } = await axios.get(
|
const { data: item } = await axios.get(
|
||||||
process.env.NEXTAUTH_URL + "/api/data/availabilities/" + context.params.id
|
process.env.PUBLIC_URL + "/api/data/availabilities/" + context.params.id
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -893,7 +893,7 @@ export const getServerSideProps = async (context) => {
|
|||||||
const axios = await axiosServer(context);
|
const axios = await axiosServer(context);
|
||||||
const baseUrl = common.getBaseUrl();
|
const baseUrl = common.getBaseUrl();
|
||||||
console.log('runtime BaseUrl: ' + baseUrl);
|
console.log('runtime BaseUrl: ' + baseUrl);
|
||||||
console.log('runtime NEXTAUTH_URL: ' + process.env.NEXTAUTH_URL);
|
console.log('runtime PUBLIC_URL: ' + process.env.PUBLIC_URL);
|
||||||
console.log('Runtime Axios Base URL:', axios.defaults.baseURL);
|
console.log('Runtime Axios Base URL:', axios.defaults.baseURL);
|
||||||
|
|
||||||
const currentDate = new Date();
|
const currentDate = new Date();
|
||||||
|
@ -7,9 +7,9 @@ export const getServerSideProps = async (context) => {
|
|||||||
console.log("edit page getServerSideProps");
|
console.log("edit page getServerSideProps");
|
||||||
const axios = await axiosServer(context);
|
const axios = await axiosServer(context);
|
||||||
const { id } = context.query;
|
const { id } = context.query;
|
||||||
const { data } = await axios.get(`${process.env.NEXTAUTH_URL}/api/data/cartevents/` + id);
|
const { data } = await axios.get(`${process.env.PUBLIC_URL}/api/data/cartevents/` + id);
|
||||||
const locations = await axios
|
const locations = await axios
|
||||||
.get(`${process.env.NEXTAUTH_URL}/api/data/locations?select=id,name`)
|
.get(`${process.env.PUBLIC_URL}/api/data/locations?select=id,name`)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log("locations: " + JSON.stringify(res.data));
|
console.log("locations: " + JSON.stringify(res.data));
|
||||||
return res.data;
|
return res.data;
|
||||||
|
@ -26,7 +26,7 @@ export const getServerSideProps = async (context) => {
|
|||||||
|
|
||||||
const axios = await axiosServer(context);
|
const axios = await axiosServer(context);
|
||||||
const locations = await axios
|
const locations = await axios
|
||||||
.get(`${process.env.NEXTAUTH_URL}/api/data/locations?select=id,name`)
|
.get(`${process.env.PUBLIC_URL}/api/data/locations?select=id,name`)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log("locations: " + JSON.stringify(res.data));
|
console.log("locations: " + JSON.stringify(res.data));
|
||||||
return res.data;
|
return res.data;
|
||||||
@ -41,7 +41,7 @@ export const getServerSideProps = async (context) => {
|
|||||||
|
|
||||||
const { id } = context.query.id;
|
const { id } = context.query.id;
|
||||||
const { data: item } = await axiosInstance.get(
|
const { data: item } = await axiosInstance.get(
|
||||||
process.env.NEXTAUTH_URL + "/api/data/cartevents/" + context.params.id
|
process.env.PUBLIC_URL + "/api/data/cartevents/" + context.params.id
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -99,11 +99,11 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
|
|||||||
const axios = await axiosServer(context);
|
const axios = await axiosServer(context);
|
||||||
|
|
||||||
const { data: location } = await axios.get(
|
const { data: location } = await axios.get(
|
||||||
`${process.env.NEXTAUTH_URL}/api/data/locations/${context.params.id}`
|
`${process.env.PUBLIC_URL}/api/data/locations/${context.params.id}`
|
||||||
);
|
);
|
||||||
if (location.backupLocationId !== null) {
|
if (location.backupLocationId !== null) {
|
||||||
const { data: backupLocation } = await axios.get(
|
const { data: backupLocation } = await axios.get(
|
||||||
process.env.NEXTAUTH_URL + "/api/data/locations/" + location.backupLocationId
|
process.env.PUBLIC_URL + "/api/data/locations/" + location.backupLocationId
|
||||||
);
|
);
|
||||||
location.backupLocationName = backupLocation.name;
|
location.backupLocationName = backupLocation.name;
|
||||||
location.backupLocationContent = backupLocation ? backupLocation.content : "";
|
location.backupLocationContent = backupLocation ? backupLocation.content : "";
|
||||||
|
@ -29,7 +29,7 @@ export const getServerSideProps = async (context) => {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
const { data: item } = await axios.get(
|
const { data: item } = await axios.get(
|
||||||
process.env.NEXTAUTH_URL + "/api/data/locations/" + context.params.id
|
process.env.PUBLIC_URL + "/api/data/locations/" + context.params.id
|
||||||
);
|
);
|
||||||
console.log(item) //this is the location object
|
console.log(item) //this is the location object
|
||||||
context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");
|
context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");
|
||||||
|
@ -32,7 +32,7 @@ export const getServerSideProps = async (context) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { data: loc } = await axios.get(
|
const { data: loc } = await axios.get(
|
||||||
`${process.env.NEXTAUTH_URL}api/data/locations/` + context.params.id
|
`${process.env.PUBLIC_URL}api/data/locations/` + context.params.id
|
||||||
);
|
);
|
||||||
console.log(location) //this is the location object
|
console.log(location) //this is the location object
|
||||||
context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");
|
context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");
|
||||||
|
@ -44,7 +44,7 @@ export const getServerSideProps = async (context) => {
|
|||||||
props: {}
|
props: {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var url = process.env.NEXTAUTH_URL + "/api/data/publishers/" + context.query.id + "?include=availabilities,assignments,assignments.shift";
|
var url = process.env.PUBLIC_URL + "/api/data/publishers/" + context.query.id + "?include=availabilities,assignments,assignments.shift";
|
||||||
console.log("GET PUBLISHER FROM:" + url)
|
console.log("GET PUBLISHER FROM:" + url)
|
||||||
const { data: item } = await axios.get(url);
|
const { data: item } = await axios.get(url);
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ export const getServerSideProps = async (context) => {
|
|||||||
props: {}
|
props: {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var url = process.env.NEXTAUTH_URL + "/api/data/publishers/" + context.query.id + "?include=availabilities,shifts";
|
var url = process.env.PUBLIC_URL + "/api/data/publishers/" + context.query.id + "?include=availabilities,shifts";
|
||||||
console.log("GET PUBLISHER FROM:" + url)
|
console.log("GET PUBLISHER FROM:" + url)
|
||||||
const { data } = await axios.get(url);
|
const { data } = await axios.get(url);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ export const getServerSideProps = async (context) => {
|
|||||||
// };
|
// };
|
||||||
// }
|
// }
|
||||||
// const { data: loc } = await axiosInstance.get(
|
// const { data: loc } = await axiosInstance.get(
|
||||||
// `${process.env.NEXTAUTH_URL}api/data/locations/` + context.params.id
|
// `${process.env.PUBLIC_URL}api/data/locations/` + context.params.id
|
||||||
// );
|
// );
|
||||||
|
|
||||||
// console.log(location) //this is the location object
|
// console.log(location) //this is the location object
|
||||||
|
@ -33,7 +33,7 @@ export const getServerSideProps = async (context) => {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// const { data: loc } = await axiosInstance.get(
|
// const { data: loc } = await axiosInstance.get(
|
||||||
// `${process.env.NEXTAUTH_URL}api/data/locations/` + context.params.id
|
// `${process.env.PUBLIC_URL}api/data/locations/` + context.params.id
|
||||||
// );
|
// );
|
||||||
// console.log(location) //this is the location object
|
// console.log(location) //this is the location object
|
||||||
// context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");
|
// context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");
|
||||||
|
2
process.d.ts
vendored
2
process.d.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
declare namespace NodeJS {
|
declare namespace NodeJS {
|
||||||
export interface ProcessEnv {
|
export interface ProcessEnv {
|
||||||
NEXTAUTH_URL: string
|
PUBLIC_URL: string
|
||||||
NEXTAUTH_SECRET: string
|
NEXTAUTH_SECRET: string
|
||||||
GITHUB_ID: string
|
GITHUB_ID: string
|
||||||
GITHUB_SECRET: string
|
GITHUB_SECRET: string
|
||||||
|
12
server.js
12
server.js
@ -28,21 +28,23 @@ let baseUrlGlobal;
|
|||||||
// require('dotenv').config();
|
// require('dotenv').config();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
console.log("initial process.env.NODE_ENV = ", process.env.NODE_ENV);
|
console.log("initial process.env.NODE_ENV = ", process.env.NODE_ENV); //NODE_ENV can be passed as docker param
|
||||||
require('dotenv').config({
|
require('dotenv').config({
|
||||||
path: `.env.${process.env.NODE_ENV}`
|
path: `.env.${process.env.NODE_ENV}`
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("process.env.NODE_ENV = ", process.env.NODE_ENV);
|
console.log("process.env.NODE_ENV = ", process.env.NODE_ENV);
|
||||||
|
|
||||||
|
const PROTOCOL = process.env.PROTOCOL;
|
||||||
const PORT = process.env.NEXT_PUBLIC_PORT || 3000;
|
const PORT = process.env.NEXT_PUBLIC_PORT || 3000;
|
||||||
const HOST = process.env.NEXT_PUBLIC_HOST;
|
const HOST = process.env.NEXT_PUBLIC_HOST;
|
||||||
|
const LOAD_CERTS = process.env.PROTOCOL === 'https';
|
||||||
|
|
||||||
const dev = process.env.NODE_ENV !== "production";
|
const dev = process.env.NODE_ENV !== "production";
|
||||||
const PROTOCOL = process.env.NEXT_PUBLIC_PROTOCOL;
|
|
||||||
const nextApp = next({ dev });
|
const nextApp = next({ dev });
|
||||||
const nextHandler = nextApp.getRequestHandler();
|
const nextHandler = nextApp.getRequestHandler();
|
||||||
console.log("process.env.SSL_ENABLED = ", process.env.SSL_ENABLED);
|
console.log("process.env.PROTOCOL = ", process.env.PROTOCOL);
|
||||||
console.log("process.env.NEXTAUTH_URL = ", process.env.NEXTAUTH_URL);
|
console.log("process.env.PUBLIC_URL = ", process.env.PUBLIC_URL);
|
||||||
console.log("process.env.NEXT_PUBLIC_PORT = ", process.env.NEXT_PUBLIC_PORT);
|
console.log("process.env.NEXT_PUBLIC_PORT = ", process.env.NEXT_PUBLIC_PORT);
|
||||||
console.log("process.env.TELEGRAM_BOT = ", process.env.TELEGRAM_BOT);
|
console.log("process.env.TELEGRAM_BOT = ", process.env.TELEGRAM_BOT);
|
||||||
|
|
||||||
@ -559,7 +561,7 @@ nextApp
|
|||||||
});
|
});
|
||||||
|
|
||||||
//check if ssl is enabled
|
//check if ssl is enabled
|
||||||
if (process.env.SSL_ENABLED === "true") {
|
if (LOAD_CERTS) {
|
||||||
console.log("SSL_ENABLED = true");
|
console.log("SSL_ENABLED = true");
|
||||||
// Redirect from http to https
|
// Redirect from http to https
|
||||||
// server.use((req, res, next) => {
|
// server.use((req, res, next) => {
|
||||||
|
@ -78,8 +78,8 @@ exports.setBaseUrl = function (req) {
|
|||||||
exports.getBaseUrl = function (relative = "", req = null) {
|
exports.getBaseUrl = function (relative = "", req = null) {
|
||||||
if (typeof window === 'undefined') {
|
if (typeof window === 'undefined') {
|
||||||
// Server-side logic
|
// Server-side logic
|
||||||
// Read the base URL from env (NEXTAUTH_URL):
|
// Read the base URL from env (PUBLIC_URL):
|
||||||
return process.env.NEXTAUTH_URL + relative;
|
return process.env.PUBLIC_URL + relative;
|
||||||
|
|
||||||
// const filePath = path.join(__dirname, 'baseUrl.txt');
|
// const filePath = path.join(__dirname, 'baseUrl.txt');
|
||||||
|
|
||||||
@ -122,6 +122,8 @@ exports.getPrismaClient = function getPrismaClient() {
|
|||||||
datasources: { db: { url: process.env.DATABASE_URL } },
|
datasources: { db: { url: process.env.DATABASE_URL } },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
logger.debug("getPrismaClient: process.env.DATABASE_URL = ", process.env.DATABASE_URL);
|
||||||
|
|
||||||
return prisma;
|
return prisma;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user