简体   繁体   中英

IBM Cloud Code Engine: How to determine app URL from environment?

I have a Python app deployed to IBM Cloud Code Engine . The app needs to determine its external URL for some security configuration. How can I obtain the app URL from the environment?

I looked at the list of injected environment variables , but could not find anything.

We just recently added some new environment variables to help with this. Depending on which region you're in they should be available today, but worst case by next week.

The new env vars you want to look for are:

  • CE_APP: the application name
  • CE_SUBDOMAIN: the subdomain (or kube namespace if you're interested) of the app/project
  • CE_DOMAIN: the domain name of the app/project you're running in.

So the full URL would be: https://${CE_APP}.${CE_SUBDOMAIN}.${CE_DOMAIN}

If you happen to be using JOBS then there's:

  • CE_JOB: the job associated with the job run, if there is a Job
  • CE_JOBRUN: the job run name

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM