Closed 6opuc closed 5 years ago
If you're using Windows, put it in your environment variables.
Click on start Type in computer Right mouse click on "This PC" and click properties Click on advanced system settings Click on environment variables Click on new Variable name is "API_BASE_URL" (without the quotes" Variable value is the URL you want
If you're using Linux, Open your .basrc or .bash_profile (they both will work) Add API_BASE_URL='your URL'
You will have to reload the terminal window on both OS's
Hope this helps
If using Windows via power shell you can:
$env:API_BASE_URL="https://THEURL"; yarn dev
I guessing you can place that in your package.json file?
Then in Linux couldn't you do: API_BASE_URL='http://TheUrl'; yarn dev
You can create a config.js
file in the root with the following.
export default {
apiURL: process.env.API_URL || 'http://127.0.0.1:<portNumber>'
}
Then in main.js
import config from './config'
Vue.prototype.$http = axios
Vue.prototype.$http.defaults.baseURL = config.apiURL
Looks like this is maybe resolved? Thanks @jessicakennedy1028, @openindustryorg, and @diazgilberto!
How to configure API_BASE_URL for production build?