tiangolo/full-stack-fastapi-couchbase

On domain change frontend/.env and others don't use DOMAIN environmental variable

giesberge opened this issue · 4 comments

Found this when switching domains it was still pointing at the old api

COUCHBASE_SYNC_GATEWAY_CORS_ORIGINS
in env-backend.env and env-sync-gateway.env

in frontend /.env
VUE_APP_DOMAIN_STAG
VUE_APP_DOMAIN_PROD

Yep, there isn't a very clean way to make Vue re-use environment variables from above without breaking local development 😞 ...so, for now, we have to stick to modifying the frontend/.env file.

Has there been any change to this? I'm implementing a feature that allows "open registration" of a custom model - it would be best if we could set one env variable, and let that change both the frontend and backend.

I've accomplished this here: paul121/farmOS-aggregator@f63abf1

In this case I wanted the OPEN_FARM_REGISTRATION variable to be used in both the backend and frontend. In the backend, this makes some API endpoints publicly accessible. In the frontend, this disables the /register-farm view from loading.

In the docker-compose file both containers receive the same arg which then gets translated into an env in their respective Dockerfiles. For the frontend, I created a .env.development file that contains the VUE_APP_var.. preconfigured for local development. This file is only used when the NODE_ENV is set to development - I think this might be a solution for the DOMAIN variable, too?

Thanks for the updates @paul121!

Unfortunately, I'm currently no longer working with any project based on this template, and I won't be able to keep it up to date. So I won't be able to work more on it, including bug fixes and features. And I can't help you with the issue @giesberge, sorry.

Of course, you are free to use any parts of the code that seem useful to you, and if you have a project built with this you probably already updated a bunch of things and you should be fine.

But this is probably not useful for new projects.

Given that, I'll close this issue. But thanks for the interest here! ☕

Sorry for the long delay! 🙈 I wanted to personally address each issue/PR and they piled up through time, but now I'm checking each one in order.