Skip to content

Commit

Permalink
fix(client): deployment configuration
Browse files Browse the repository at this point in the history
- fix environment names for k8s deployment
  • Loading branch information
cgawron committed Oct 9, 2023
1 parent 8987d44 commit 710b9dc
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 37 deletions.
18 changes: 9 additions & 9 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM node:18-bullseye as build
ARG REACT_APP_GOOGLE_ID=692793330469-6iupo55tt0kelejcie26m4njeckbmnv8.apps.googleusercontent.com
ARG REACT_BASE_PATH=/meeting
ARG REACT_APP_URL=https://hopper.fh-swf.de/meeting
ARG REACT_APP_API_URI=https://hopper.fh-swf.de/meeting/api/v1
ARG CLIENT_ID=692793330469-6iupo55tt0kelejcie26m4njeckbmnv8.apps.googleusercontent.com
ARG BASE_PATH=/meeting
ARG APP_URL=https://hopper.fh-swf.de/meeting
ARG API_URL=https://hopper.fh-swf.de/meeting/api/v1

ENV REACT_APP_GOOGLE_ID=${REACT_APP_GOOGLE_ID}
ENV REACT_BASE_PATH=${REACT_BASE_PATH}
ENV REACT_APP_URL=${REACT_APP_URL}
ENV REACT_APP_API_URI=${REACT_APP_API_URI}
ENV CLIENT_ID=${CLIENT_ID}
ENV BASE_PATH=${BASE_PATH}
ENV APP_URL=${APP_URL}
ENV API_URL=${API_URL}

WORKDIR /base
COPY .yarn .yarn
Expand All @@ -25,4 +25,4 @@ COPY ./common ./common
RUN yarn workspace common build

COPY ./client ./client
CMD ["yarn", "worspace", "client", "start"]
CMD ["yarn", "workspace", "client", "start"]
2 changes: 1 addition & 1 deletion client/src/components/AppNavbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const AppNavbar = () => {
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
const [snack, setSnack] = React.useState<string | null>(null);

const link = user ? process.env.REACT_APP_URL + "/users/" + user.user_url : "";
const link = user ? process.env.APP_URL + "/users/" + user.user_url : "";

console.log("AppNavbar: user=%o", user);

Expand Down
10 changes: 5 additions & 5 deletions client/src/helpers/services/auth_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios from "axios";

export async function postToRegister(name, email, password) {
const response = await axios.post(
`${process.env.REACT_APP_API_URI}/auth/register`,
`${process.env.API_URL}/auth/register`,
{
name,
email,
Expand All @@ -15,7 +15,7 @@ export async function postToRegister(name, email, password) {

export async function postToActivate(token) {
const response = await axios.post(
`${process.env.REACT_APP_API_URI}/auth/activate`,
`${process.env.API_URL}/auth/activate`,
{},
{
headers: {
Expand All @@ -28,9 +28,9 @@ export async function postToActivate(token) {
}

export async function postGoogleLogin(code) {
console.log("postGoogleLogin: %s", `${process.env.REACT_APP_API_URI}/auth/google_oauth2_code`);
console.log("postGoogleLogin: %s", `${process.env.API_URL}/auth/google_oauth2_code`);
const response = await axios.post(
`${process.env.REACT_APP_API_URI}/auth/google_oauth2_code`,
`${process.env.API_URL}/auth/google_oauth2_code`,
{
code,
},
Expand All @@ -43,7 +43,7 @@ export async function postGoogleLogin(code) {

export async function postLogin(email, password) {
const response = await axios.post(
`${process.env.REACT_APP_API_URI}/auth/login`,
`${process.env.API_URL}/auth/login`,
{
email,
password: password,
Expand Down
16 changes: 8 additions & 8 deletions client/src/helpers/services/event_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function saveUserEvent(
userid: string
) {
const response = await axios.post(
`${process.env.REACT_APP_API_URI}/events/addEvent`,
`${process.env.API_URL}/events/addEvent`,
{ ...event, user: userid },
{
headers: {
Expand All @@ -20,7 +20,7 @@ export async function saveUserEvent(

export async function deleteEvent(token: string, id: string) {
const response = await axios.delete(
`${process.env.REACT_APP_API_URI}/events/deleteEvent/${id}`,
`${process.env.API_URL}/events/deleteEvent/${id}`,
{
headers: {
Authorization: "Bearer " + token,
Expand All @@ -33,7 +33,7 @@ export async function deleteEvent(token: string, id: string) {

export async function getEventByID(token: string, id: string) {
const response = await axios.get(
`${process.env.REACT_APP_API_URI}/events/getEvent/${id}`,
`${process.env.API_URL}/events/getEvent/${id}`,
{
headers: {
Authorization: "Bearer " + token,
Expand All @@ -51,7 +51,7 @@ export async function updateEvent(
) {
console.log('available: %o', event.available);
const response = await axios.put(
`${process.env.REACT_APP_API_URI}/events/updateEvent/${id}`,
`${process.env.API_URL}/events/updateEvent/${id}`,
{
data: event
},
Expand All @@ -66,7 +66,7 @@ export async function updateEvent(

export async function getActiveEvents(user_id: string) {
const response = await axios.get(
`${process.env.REACT_APP_API_URI}/events/getActiveEvents`,
`${process.env.API_URL}/events/getActiveEvents`,
{
params: { user: user_id },
}
Expand All @@ -76,7 +76,7 @@ export async function getActiveEvents(user_id: string) {

export function getAvailableTimes(timeMin: Date, timeMax: Date, url: string, userid: string) {
return axios.get(
`${process.env.REACT_APP_API_URI}/events/getAvailable`,
`${process.env.API_URL}/events/getAvailable`,
{
params: {
timeMin,
Expand All @@ -91,7 +91,7 @@ export function getAvailableTimes(timeMin: Date, timeMax: Date, url: string, use

export async function getUsersEvents(token: string) {
const response = await axios.get(
`${process.env.REACT_APP_API_URI}/events/getEvents`,
`${process.env.API_URL}/events/getEvents`,
{
headers: {
Authorization: "Bearer " + token,
Expand All @@ -103,7 +103,7 @@ export async function getUsersEvents(token: string) {

export async function getEventByUrlAndUser(user_id: string, event_url: string) {
return axios.get(
`${process.env.REACT_APP_API_URI}/events/getEventBy`,
`${process.env.API_URL}/events/getEventBy`,
{
params: { user: user_id, url: event_url },
}
Expand Down
8 changes: 4 additions & 4 deletions client/src/helpers/services/google_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios from "axios";

export async function deleteAccess(token) {
const response = await axios.delete(
`${process.env.REACT_APP_API_URI}/google/revoke`,
`${process.env.API_URL}/google/revoke`,
{
data: null,
headers: {
Expand All @@ -15,7 +15,7 @@ export async function deleteAccess(token) {

export async function getAuthUrl(token) {
const response = await axios.get(
`${process.env.REACT_APP_API_URI}/google/generateUrl`,
`${process.env.API_URL}/google/generateUrl`,
{
headers: {
Authorization: "Bearer " + token,
Expand All @@ -27,7 +27,7 @@ export async function getAuthUrl(token) {

export async function getCalendarList(token) {
const response = await axios.get(
`${process.env.REACT_APP_API_URI}/google/calendarList`,
`${process.env.API_URL}/google/calendarList`,
{
headers: {
Authorization: "Bearer " + token,
Expand All @@ -47,7 +47,7 @@ export async function insertIntoGoogle(
) {
const starttime = time.valueOf();
const response = axios.post(
`${process.env.REACT_APP_API_URI}/google/insertEvent/${user_id}`,
`${process.env.API_URL}/google/insertEvent/${user_id}`,
{
event,
starttime,
Expand Down
6 changes: 3 additions & 3 deletions client/src/helpers/services/user_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios from "axios";

export async function getUserByToken(token: string) {
const response = await axios.get(
`${process.env.REACT_APP_API_URI}/users/user`,
`${process.env.API_URL}/users/user`,
{
headers: {
Authorization: "Bearer " + token,
Expand All @@ -14,7 +14,7 @@ export async function getUserByToken(token: string) {

export async function updateUser(token: string, user: any) {
const response = await axios.put(
`${process.env.REACT_APP_API_URI}/users/user`,
`${process.env.API_URL}/users/user`,
{ data: user },
{
headers: {
Expand All @@ -27,7 +27,7 @@ export async function updateUser(token: string, user: any) {

export async function getUserByUrl(url: string) {
return axios.get(
`${process.env.REACT_APP_API_URI}/users/findUserByUrl`,
`${process.env.API_URL}/users/findUserByUrl`,
{
params: { url: url },
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ i18n

backend: {
// for all available options read the backend's repository readme file
loadPath: process.env.REACT_APP_URL + '/locales/{{lng}}/{{ns}}.json'
loadPath: process.env.PP_URL + '/locales/{{lng}}/{{ns}}.json'
},
interpolation: {
escapeValue: false, // not needed for react as it escapes by default
}
});


export default i18n;
export default i18n;
10 changes: 5 additions & 5 deletions client/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Suspense, } from "react";
import React, { Suspense, } from "react";
import ReactDOM from "react-dom";
import { createRoot } from 'react-dom/client';

Expand Down Expand Up @@ -82,15 +82,15 @@ const theme = createTheme({
const container = document.getElementById("root");
const root = createRoot(container);

const GOOGLE_ID = process.env.REACT_APP_GOOGLE_ID;
const BASE_PATH = process.env.REACT_BASE_PATH || "/meeting";
const CLIENT_ID = process.env.CLIENT_ID;
const BASE_PATH = process.env.BASE_PATH || "/meeting";

console.log("base url: %s %s", process.env.REACT_APP_URL, process.env.REACT_BASE_PATH);
console.log("base url: %s %s", process.env.APP_URL, process.env.BASE_PATH);

root.render(
<React.StrictMode>
<Suspense fallback="loading">
<GoogleOAuthProvider clientId={GOOGLE_ID}>
<GoogleOAuthProvider clientId={CLIENT_ID}>
<LocalizationProvider dateAdapter={AdapterDateFns}>
<ThemeProvider theme={theme}>
<BrowserRouter basename={BASE_PATH}>
Expand Down

0 comments on commit 710b9dc

Please sign in to comment.