Environment variables during runtime
After running is it possible for me to still set the environment variables, such as the API_URL, that react refine will use?
2 Replies
Hi @.chasel. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Yes, you can set environment variables in your refine application. However, it's important to note that environment variables should be set before running the
npm run build
command. This is because the build process will use these variables to create an optimized production build of your application.
For example, if you want to set the API_URL
for your application, you can do this in a .env
file in your project root. Here's an example of how you can set the API_URL
:
After setting your environment variables, you can then run npm run build
to create a production build of your application. The build process will use the environment variables you've set.
Remember to restart your development server after setting the environment variables to ensure they take effect.
For more information, refer to the refine documentation (https://refine.dev/docs/packages/documentation/cli) and the refine blog (https://refine.dev/blog/react-search-bar-and-filtering).
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@196423433930670080> kapa.ai is still learning and improving, please let us how it did by reacting below