Right way to set up STRAPI_URL in .env
See original GitHub issueHow do I use STRAPI_URL ? I have tried the following:
File .env
:
STRAPI_URL="http://localhost:1337"
File .env.production
:
STRAPI_URL="https://my-app.herokuapp.com/"
In nuxt.config.js
I have first tried to set env property and the new runtime config:
env: {
STRAPI_URL: process.env.STRAPI_URL || 'http://localhost:1337',
},
publicRuntimeConfig: {
STRAPI_URL: process.env.STRAPI_URL,
},
Then I have also tried the url option:
strapi: {
url: process.env.STRAPI_URL || 'http://localhost:1337',
},
It doesn’t work, $strapi
is always doing calls to localhost:1337.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Environment configuration and variables - Strapi documentation
BROWSER, Open the admin panel in the browser after startup, Boolean, true ; ENV_PATH, Path to the file that contains your environment variables,...
Read more >Right way to set up STRAPI_URL in .env · Issue #67 - GitHub
In nuxt.config.js I have first tried to set env property and the new runtime config: env: { STRAPI_URL ...
Read more >Configuration
Your application configuration lives in the config folder. All the configuration files are loaded on startup and can be accessed through the configuration ......
Read more >Strapi - Configure with environment variables - Stack Overflow
Looks like the only way is to use a hook. In my server.js file (I would move the config into it's own file...
Read more >The Strapi Configuration Folder - Strapi /config - YouTube
Strapi 3.0.0 Stable Release introduces a new and simplified way to ... and give you an example of setting up multi- environment configuration ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@luixal you don’t need to require(‘dotenv’), Nuxt does it for you.
@baermathias This is a valid solution, keep in my mind that you may expose sensitive information to git if this file is not gitignore
@Atinux right, it isn’t need. I would assure I had to add it once, but I can confirm it’s working without 😃