Open codingfabi opened 1 year ago
@redfrexx @sami1riaz let me know what you guys think :)
Sounds good! I think it would be good to put the URLS into the .env file as well, so that in case we have to change them we don't have to search in the code.
We could also shorten them to local
, test
and prod
.
Currently we root the backend requests in the apollo client dependent on the environment variable
NEXT_PUBLIC_DEV
:This could lead to problems when deploying the software on the production service because
https://api.test-pledge4future.heigit.org/graphql/
will then no longer be the valid url for the backend.To overcome this problem, I suggest to remove the
NEXT_PUBLIC_DEV
environment variable and introduce a new one called 'NEXT_PUBLIC_INSTANCE`. We can then specify a string for this variable that specifies, wether the application is hosted in a local dev setup, in the test instance or the production instance.We define three valid strings:
p4f-local
,p4f-test
andp4f-prod
. With these values, we can then get the following constellations with the resulting API url defined by a function that looks like this: