tiangolo / full-stack-fastapi-couchbase

Full stack, modern web application generator. Using FastAPI, Couchbase as database, Docker, automatic HTTPS and more.
MIT License
441 stars 84 forks source link

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

Closed giesberge closed 2 years ago

giesberge commented 5 years ago

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

tiangolo commented 5 years ago

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

paul121 commented 4 years ago

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.

paul121 commented 4 years ago

I've accomplished this here: https://github.com/paul121/farmOS-aggregator/commit/f63abf17999aab8046cda21e89c86bfe058115da

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?

tiangolo commented 2 years ago

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! :coffee:

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.