Merge remote-tracking branch 'origin/production'

This commit is contained in:
Dobromir Popov
2024-04-02 02:05:16 +03:00
20 changed files with 28 additions and 27 deletions

View File

@ -1,7 +1,7 @@
PROTOCOL=http
HOST=staging.mwhitnessing.com
HOST=staging.mwitnessing.com
PORT=
NEXT_PUBLIC_PUBLIC_URL=https://staging.mwhitnessing.com
NEXT_PUBLIC_PUBLIC_URL=https://staging.mwitnessing.com
# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32
NEXTAUTH_SECRET=1dd8a5457970d1dda50600be28e935ecc4513ff27c49c431849e6746f158d638

View File

@ -1,6 +1,6 @@
version: "3"
services:
nextjs-app: # https://sofia.mwhitnessing.com/
nextjs-app: # https://sofia.mwitnessing.com/
hostname: jwpw-app-staging # jwpw-nextjs-app-1
image: docker.d-popov.com/jwpw:latest
volumes:

View File

@ -1,6 +1,6 @@
version: "3"
services:
nextjs-app: # https://sofia.mwhitnessing.com/
nextjs-app: # https://sofia.mwitnessing.com/
hostname: jwpw-app # jwpw-nextjs-app-1
image: docker.d-popov.com/jwpw:latest
deploy:

View File

@ -10,7 +10,7 @@ if [ "$UPDATE_CODE_FROM_GIT" = "true" ]; then
mkdir /tmp/clone
# Clone the repository
git clone -b ${GIT_BRANCH:-main} --depth 1 https://$GIT_USERNAME:${GIT_PASSWORD//@/%40}@git.d-popov.com/popov/mwhitnessing.git /tmp/clone || exit 1
git clone -b ${GIT_BRANCH:-main} --depth 1 https://$GIT_USERNAME:${GIT_PASSWORD//@/%40}@git.d-popov.com/popov/mwitnessing.git /tmp/clone || exit 1
# Synchronize all files except package.json and package-lock.json to /app
rsync -av --delete --exclude 'package.json' --exclude 'package-lock.json' /tmp/clone/ /app/ || echo "Rsync failed: Issue synchronizing files"

View File

@ -24,12 +24,12 @@ import { isLoggedIn, setAuthTokens, clearAuthTokens, getAccessToken, getRefreshT
export const authOptions: NextAuthOptions = {
// https://next-auth.js.org/configuration/providers/oauth
site: process.env.PUBLIC_URL,
site: process.env.NEXT_PUBLIC_PUBLIC_URL,
secret: process.env.NEXTAUTH_SECRET, // Ensure you have this set in your .env file
//adapter: PrismaAdapter(prisma),
providers: [
// register new URL at https://console.cloud.google.com/apis/credentials/oauthclient/926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com?project=grand-forge-108716
//Request details: redirect_uri=http://20.101.62.76:8005/api/auth/callback/google https://s.mwhitnessing.com/
//Request details: redirect_uri=http://20.101.62.76:8005/api/auth/callback/google https://s.mwitnessingmwitnessing.com/
GoogleProvider({
clientId: process.env.GOOGLE_ID,
clientSecret: process.env.GOOGLE_SECRET,

View File

@ -617,6 +617,7 @@ export async function filterPublishers(selectFields, searchText, filterDate, fet
dayOfMonth: null,
dayofweek: dayOfWeekEnum,
}
]
}
};
}

View File

@ -444,7 +444,7 @@ async function GenerateSchedule(axios: Axios, date: string, copyFromPreviousMont
}
//create shifts using API
// const { data: createdShifts } = await axios.post(`${process.env.PUBLIC_URL}/api/data/shifts`, shiftsToCreate);
// const { data: createdShifts } = await axios.post(`${process.env.NEXT_PUBLIC_PUBLIC_URL}/api/data/shifts`, shiftsToCreate);
//const { data: allshifts } = await axios.get(`/api/data/shifts`);
return {}; //allshifts;

View File

@ -133,7 +133,7 @@ export const getServerSideProps = async (context) => {
const role = session?.user.role;
console.log("server role: " + role);
var queryUrl = process.env.PUBLIC_URL + "/api/data/availabilities?select=id,name,isActive,dayofweek,dayOfMonth,startTime,endTime,publisher.firstName,publisher.lastName,publisher.id";
var queryUrl = process.env.NEXT_PUBLIC_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) {
queryUrl += `&where={"publisherId":"${session?.user.id}"}`;
} else if (role == UserRole.ADMIN) {
@ -145,7 +145,7 @@ export const getServerSideProps = async (context) => {
}
var resp = await axios.get(
queryUrl
// process.env.PUBLIC_URL + "/api/data/availabilities?include=publisher",
// process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/availabilities?include=publisher",
, { decompress: true });
var items = resp.data;
console.log("got " + items.length + " availabilities");

View File

@ -31,7 +31,7 @@ export const getServerSideProps = async (context) => {
};
}
const { data: item } = await axios.get(
process.env.PUBLIC_URL + "/api/data/availabilities/" + context.params.id
process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/availabilities/" + context.params.id
);
return {

View File

@ -891,9 +891,9 @@ import axiosServer from '../../../src/axiosServer';
import { start } from 'repl';
export const getServerSideProps = async (context) => {
const axios = await axiosServer(context);
const baseUrl = common.getBaseUrl();
console.log('runtime BaseUrl: ' + baseUrl);
console.log('runtime PUBLIC_URL: ' + process.env.PUBLIC_URL);
// const baseUrl = common.getBaseUrl();
// console.log('runtime BaseUrl: ' + baseUrl);
console.log('runtime NEXT_PUBLIC_PUBLIC_URL: ' + process.env.NEXT_PUBLIC_PUBLIC_URL);
console.log('Runtime Axios Base URL:', axios.defaults.baseURL);
const currentDate = new Date();

View File

@ -7,9 +7,9 @@ export const getServerSideProps = async (context) => {
console.log("edit page getServerSideProps");
const axios = await axiosServer(context);
const { id } = context.query;
const { data } = await axios.get(`${process.env.PUBLIC_URL}/api/data/cartevents/` + id);
const { data } = await axios.get(`${process.env.NEXT_PUBLIC_PUBLIC_URL}/api/data/cartevents/` + id);
const locations = await axios
.get(`${process.env.PUBLIC_URL}/api/data/locations?select=id,name`)
.get(`${process.env.NEXT_PUBLIC_PUBLIC_URL}/api/data/locations?select=id,name`)
.then((res) => {
console.log("locations: " + JSON.stringify(res.data));
return res.data;

View File

@ -26,7 +26,7 @@ export const getServerSideProps = async (context) => {
const axios = await axiosServer(context);
const locations = await axios
.get(`${process.env.PUBLIC_URL}/api/data/locations?select=id,name`)
.get(`${process.env.NEXT_PUBLIC_PUBLIC_URL}/api/data/locations?select=id,name`)
.then((res) => {
console.log("locations: " + JSON.stringify(res.data));
return res.data;
@ -41,7 +41,7 @@ export const getServerSideProps = async (context) => {
const { id } = context.query.id;
const { data: item } = await axiosInstance.get(
process.env.PUBLIC_URL + "/api/data/cartevents/" + context.params.id
process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/cartevents/" + context.params.id
);
return {

View File

@ -99,11 +99,11 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
const axios = await axiosServer(context);
const { data: location } = await axios.get(
`${process.env.PUBLIC_URL}/api/data/locations/${context.params.id}`
`${process.env.NEXT_PUBLIC_PUBLIC_URL}/api/data/locations/${context.params.id}`
);
if (location.backupLocationId !== null) {
const { data: backupLocation } = await axios.get(
process.env.PUBLIC_URL + "/api/data/locations/" + location.backupLocationId
process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/locations/" + location.backupLocationId
);
location.backupLocationName = backupLocation.name;
location.backupLocationContent = backupLocation ? backupLocation.content : "";

View File

@ -29,7 +29,7 @@ export const getServerSideProps = async (context) => {
};
}
const { data: item } = await axios.get(
process.env.PUBLIC_URL + "/api/data/locations/" + context.params.id
process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/locations/" + context.params.id
);
console.log(item) //this is the location object
context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");

View File

@ -32,7 +32,7 @@ export const getServerSideProps = async (context) => {
}
const { data: loc } = await axios.get(
`${process.env.PUBLIC_URL}api/data/locations/` + context.params.id
`${process.env.NEXT_PUBLIC_PUBLIC_URL}api/data/locations/` + context.params.id
);
console.log(location) //this is the location object
context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");

View File

@ -44,7 +44,7 @@ export const getServerSideProps = async (context) => {
props: {}
};
}
var url = process.env.PUBLIC_URL + "/api/data/publishers/" + context.query.id + "?include=availabilities,assignments,assignments.shift";
var url = process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/publishers/" + context.query.id + "?include=availabilities,assignments,assignments.shift";
console.log("GET PUBLISHER FROM:" + url)
const { data: item } = await axios.get(url);

View File

@ -47,7 +47,7 @@ export const getServerSideProps = async (context) => {
props: {}
};
}
var url = process.env.PUBLIC_URL + "/api/data/publishers/" + context.query.id + "?include=availabilities,shifts";
var url = process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/publishers/" + context.query.id + "?include=availabilities,shifts";
console.log("GET PUBLISHER FROM:" + url)
const { data } = await axios.get(url);

View File

@ -32,7 +32,7 @@ export const getServerSideProps = async (context) => {
// };
// }
// const { data: loc } = await axiosInstance.get(
// `${process.env.PUBLIC_URL}api/data/locations/` + context.params.id
// `${process.env.NEXT_PUBLIC_PUBLIC_URL}api/data/locations/` + context.params.id
// );
// console.log(location) //this is the location object

View File

@ -33,7 +33,7 @@ export const getServerSideProps = async (context) => {
// }
// const { data: loc } = await axiosInstance.get(
// `${process.env.PUBLIC_URL}api/data/locations/` + context.params.id
// `${process.env.NEXT_PUBLIC_PUBLIC_URL}api/data/locations/` + context.params.id
// );
// console.log(location) //this is the location object
// context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");

View File

@ -43,7 +43,7 @@ const dev = process.env.NODE_ENV !== "production";
const nextApp = next({ dev });
const nextHandler = nextApp.getRequestHandler();
console.log("process.env.PROTOCOL = ", process.env.PROTOCOL);
console.log("process.env.PUBLIC_URL = ", process.env.NEXT_PUBLIC_PUBLIC_URL);
console.log("process.env.NEXT_PUBLIC_PUBLIC_URL = ", process.env.NEXT_PUBLIC_PUBLIC_URL);
console.log("process.env.PORT = ", process.env.PORT);
console.log("process.env.TELEGRAM_BOT = ", process.env.TELEGRAM_BOT);