2

I am trying to pass environment vairable setup inside asp.net core (kesterl) to vuejs My launchsettings is like

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "https://localhost:44323/",
      "sslPort": 44323
    }
  },
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "BEAPI_URL": "http://localhost:4000/api/v1",
        "VUE_BEAPI_URL": "http://localhost:4000/api/v1"
      }
    },    
  }
}

and my vuejs config is as following

export default {
    // apiUrl: 'http://localhost:4000/api/v1'    
    apiUrl: process.env.VUE_BEAPI_URL
    
}

Anyone help like my scenario Other then this my vuejs app is working fine under kesterl

2
  • What version of vue.js you are using? May be you need to add the Prefix VUE_APP_ to ENVs to make them available in your vue.js application. stackoverflow.com/q/50828904/83039 Commented Mar 17, 2021 at 11:12
  • I have tried adding VUE_APP_ suffix but no effect. vuejs version is 2.6.12 Commented Mar 17, 2021 at 11:28

1 Answer 1

0

Following settings have worked kesterl launchsetting (for environment variable name reference)

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "https://localhost:44323/",
      "sslPort": 44323
    }
  },
  "$schema": "http://json.schemastore.org/launchsettings.json",
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "VUE_APP_BEAPI_URL": "http://localhost:4000/api/v1"
      }
    }
  }
}

vuejs config

export default {
    // apiUrl: 'http://localhost:4000/api/v1',
    apiUrl: process.env.VUE_APP_BEAPI_URL,
    access_token:''
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.