Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use env variable for backend services #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

francbartoli
Copy link
Member

This is breaking the current local run!!! PLEASE USE the following to run now:

export REACT_APP_BACKEND_PUBLIC_URL=https://arpav.geobeyond.dev
yarn run start

Copy link

@ricardogsilva ricardogsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works as a quick fix for allowing configuration of the backend URL at the time of building the docker image, which is good.

However, it is leaving some stuff in a bit of a messy state (check my inline comments) so I'd prefer to have them properly cleaned up.

I would preferably fix the mentioned messyness in this PR, but for the sake of urgency I'd be OK with merging this PR, provided that things get cleaned up soon 🥵

@@ -56,7 +56,9 @@ export class RequestApi extends Http {
}
return this.instance
.get<any>(
'https://arpav.geobeyond.dev/api/v2/coverages/forecast-data?',
//'https://arpav.geobeyond.dev/api/v2/coverages/forecast-data?',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would get rid of the commented out values throughout, as they are not needed anymore with this change

@@ -3,7 +3,8 @@ export const API_URL = 'https://clima.arpa.veneto.it/backend/'; //process.env.RE
export const V2_API_URL = 'https://clima.arpa.veneto.it/backend/'; //process.env.REACT_APP_API_URL as string;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would clean this file up, as it is getting confusing. Which of these variables are actually used in the code, if any?

@@ -14,6 +14,7 @@ RUN yarn build
# Bundle static assets with nginx
FROM nginx:1.21.0-alpine as production
ENV NODE_ENV production
ENV REACT_APP_BACKEND_PUBLIC_URL https://clima.arpa.veneto.it

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now have three dockerfiles, which seem to differ only in how they are getting these env variables - how about consolidating into a single Dockerfile, which has default values for these env values suitable for dev, and which can then be parametrized when running docker build via passing --build-args for them?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coping with three different Dockerfiles is also introducing some unneeded complexity to the CI workflow, which I'd try to avoid as much as possible

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree that would be the optimal target but for now since this was the current status I don't want to change too much

@ricardogsilva
Copy link

@francbartoli I have taken the most relevant bits of this PR and used them in #17, with further changes that allow specifying the env when starting a docker container.

As such, let's close this in favor of #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants