-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix/sofialink #913
base: staging
Are you sure you want to change the base?
Fix/sofialink #913
Conversation
This reverts commit 8a4d407.
app/components/menu-sidebar.js
Outdated
if (config.environment === 'development') { | ||
return 'http://localhost:5000'; | ||
} else if (config.environment === 'staging') { | ||
} else if (config.deployTarget === 'staging') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are now using two variables here, is that wise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that is not the ideal situation. but is better then the situation now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I did some more research it is possible to use one variable however we need to rewrite logic in the envirment.js file and change the docker files on the server. I think this has too high a risk of breaking something to be worth it, if you don't agree we can look into the possibility of doing it in an other manner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so my point is that environment
and deployTarget
seem to be used in similar context in similar ways. Why do we distinguish between them? Can you explain?
There are currently four places where config.environment
is used, and I don't see why we couldn't use config.deployTarget
instead. How are these two variables really different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't write the original code, so I can't explain it with certainty. I think the general idea was that we have three environments: test, development, and production. All three are different environments and sometimes require different dependencies.
within the production environment we have 2 deploy targets: production and staging, it is confusing that we use production twice. the difference between these deploy targets are configurations they should use the same dependencies.
This leads me to think the second suggestion is the better of the 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay that does clear things up a bit, I'm still confused about some stuff but I'll try to formulate my thoughts:
- My intuition tells me that direct access to
deployTarget
is not something themenu-sidebar.js
needs to be responsible for. It should not have to think too much about what the sofiaUrl is, just likerouter.js
does not have to think too hard about whatrootUrl
is. So, my recommendation is to move the logic for determining the sofiaUrl out ofmenu-sidebar.js
and intoenvironment.js
. - I agree that using
production
twice is confusing. I'm not sure what theproduction
environment refers to, but the other two should be clear. I think that theproduction
environment might really mean areal-world
environment? There's a bunch of words for it,build
could also be an alternative. Then you would havetest
,development
,build
. - You say there are 2 deploy targets, I would say there is an extra implicit deployTarget:
local
. You can recognize this inenvironment.js
by seeing thatENV.clientId
has a fall back value for whendeployTarget
is neitherproduction
orstaging
. We don't need to write this down because it requires extra work - I feel like the
sofiaUrl
should not depend onenvironment
, but ondeployTarget
. In general, I think most config values should not depend on what environment we're running in, but what target we're running on. Theenvironment
feels more like a 'mode' of running, whiledeployTarget
feels like a 'place'.
However, there are still things we definitely should turn off or on based on which 'mode' we're in. Two examples are sentry and apparently service workers (no clue what those are).
Like you mentioned, different environments may require different dependencies.
TLDR
- I identify three envs:
test
,development
,production
(orbuild
, we could rename to that) - I identify three deploy targets:
local
,staging
,production
- we should define
config.sofiaUrl
, and determine its value inenvironment.js
whereconfig.rootUrl
is also defined. - we should stop using
config.environment
to determineconfig.sofiaUrl
: it should only really depend onconfig.deployTarget
i.e. where is the code running.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(yes I'm aware that we're going beyond the scope of this PR, I hope you don't mind. if you prefer to get staging working first, and discuss details like this later, I can approve this PR and you can make my suggested changes in another PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I agree with the first point you are making.
As far I understand this is correct "I think that the production environment might really mean a real-world environment" Build would be a better alternative. I can make an issue for this.
However I don't agree with the third point, there are 2 deploy targets we deploy to using GitHub actions. We dont deploy to local or test but we do need a variable for clientID otherwise we are unable to connect to amber-api.
I have no problem with discussing it thoroughly, I learn alot doing this so i am happy.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## staging #913 +/- ##
===========================================
+ Coverage 13.79% 13.80% +0.01%
===========================================
Files 450 450
Lines 3067 3063 -4
===========================================
Hits 423 423
+ Misses 2644 2640 -4 ☔ View full report in Codecov by Sentry. |
edited the link in envoriment so the staging site links to stagingstreep.csvalpha.nl instead of streep.csvalpha.nl