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

Feature request: support runtime domain config #71

Open
existe-deja opened this issue Sep 25, 2023 · 2 comments
Open

Feature request: support runtime domain config #71

existe-deja opened this issue Sep 25, 2023 · 2 comments
Assignees

Comments

@existe-deja
Copy link

existe-deja commented Sep 25, 2023

Hi,

It would be nice to support runtime configuration instead of build only. I manage a project with a staging domain and I have to build it separately to handle different domains.

edit: I use the nuxt 3 component module

@mbgspcii mbgspcii self-assigned this Sep 25, 2023
@mbgspcii
Copy link
Collaborator

Hi @existe-deja.

In fact, TwicPics Nuxt3 module already uses runTimeConfig.

This is the plugin.js used in our Nuxt3 module:

image

Now, in a Nuxt3 project we configure the module like this:

Capture d’écran 2023-09-28 à 17 49 20

(with a default config)

And then we can add an .env file to our project like this:

NUXT_PUBLIC_TWICPICS_DOMAIN="https://demo.twic.it"
NUXT_PUBLIC_TWICPICS_ANTICIPATION=50
NUXT_PUBLIC_TWICPICS_STEP=100

We we run the project

Capture d’écran 2023-09-28 à 17 52 23

we actually use the domain as configured in the .env file.

But I don't think that's meets your needs. In fact, if you modify the .env file, you'll have to redo a Nuxt dev (or build) so that the modifications are taken into account.

To be honest, I don't see how you can modify your environment variables once the project has been built.

Could you clarify this for me so that we can take a closer look?

Looking forward to reading you.

Miguel

@existe-deja
Copy link
Author

Hi, thanks for your answer. I can use the NUXT_PUBLIC_TWICPICS_DOMAIN env variable and it works fine even after a build. Thing is twicpics nuxt3 module require a domain option even if i set one in the with the env variable.

Can you make it optional?

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

No branches or pull requests

2 participants