简体   繁体   English

IBM Cloud Code Engine:如何从环境中确定应用程序 URL?

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

I have a Python app deployed to IBM Cloud Code Engine .我有一个部署到IBM Cloud Code Engine的 Python 应用程序。 The app needs to determine its external URL for some security configuration.应用程序需要为某些安全配置确定其外部 URL。 How can I obtain the app URL from the environment?如何从环境中获取应用程序 URL?

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_APP:应用名称
  • CE_SUBDOMAIN: the subdomain (or kube namespace if you're interested) of the app/project CE_SUBDOMAIN:应用程序/项目的子域(或 kube 命名空间,如果您感兴趣)
  • CE_DOMAIN: the domain name of the app/project you're running in. CE_DOMAIN:您正在运行的应用程序/项目的域名。

So the full URL would be: https://${CE_APP}.${CE_SUBDOMAIN}.${CE_DOMAIN}所以完整的 URL 应该是: https://${CE_APP}.${CE_SUBDOMAIN}.${CE_DOMAIN}

If you happen to be using JOBS then there's:如果您碰巧正在使用 JOBS,那么有:

  • CE_JOB: the job associated with the job run, if there is a Job CE_JOB:与作业运行关联的作业,如果有作业
  • CE_JOBRUN: the job run name CE_JOBRUN:作业运行名称

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Cloud App Engine:如何在灵活的环境中提供https - Google Cloud App Engine: How to serve https in a Flexible environment 如何将 IBM cloudant 数据库连接到 IBM 云(云基础设施)上的 python 应用程序代码? - how to connect IBM cloudant database to python app code already on IBM cloud(cloud foundary)? 如何在Python Flask中从IBM Cloud App ID注销/注销 - How to logout / signout from IBM Cloud App ID in Python Flask 如何通过App Engine标准Python环境在目录中提供文件 - How to serve Files in a Directory from App Engine Standard Python Environment 如何使用App Engine上的Python标准环境连接到Cloud SQL上的Postgres - How to connect to Postgres on Cloud SQL using the Python Standard Environment on App Engine 如何从Google App Engine读取Google Cloud Storage文件 - How to read a Google Cloud Storage file from Google App Engine 如何从 App Engine 将图像上传到 Google Cloud Storage - How to upload an image to Google Cloud Storage from App Engine Google Cloud SQL-操作系统环境未设置为Google App Engine - Google Cloud SQL - OS environment not set to Google App Engine 在开发环境中使用Cloud SQL的Google App Engine上的Django - Django on Google App Engine with Cloud SQL in dev environment 从python后端到Google Cloud Storage中文件的公共URL(Google App Engine) - Public URL to files in Google Cloud Storage from python backend (Google App Engine)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM