2016-12-02 81 views
2

如果我在一個空間中有MessageHub服務,MY_ANALYTICS_SPACE,並且我在另一個空間中有應用程序MY_WEBAPPS_SPACE。這些空間代表了組織的兩個不同部分,並被設計爲保持獨立。我可以將外部服務VCAP_SERVICES注入我的應用程序嗎?

但是,像MessageHub這樣的企業級集成技術可能會跨越多個空間。

當服務和應用程序位於不同的空間時,是否可以將MessageHub的連接詳細信息注入我的應用程序的VCAP_SERVICES

回答

4

感謝您的問題。

是的,這種能力是由user-provided服務功能提供的。

下面是一些例子shell腳本調用,將實現這一點:

cf target -s MY_ANALYTICS_SPACE 
cf create-service messagehub standard common-messagehub 
cf create-service-key common-messagehub Credentials-1 
JSON=$(cf service-key common.messagehub Credentials-1 | tail -n +3) 
cf target -s MY_WEBAPPS_SPACE 
cf create-user-provided-service common-messagehub -p "${JSON}" \ 
    || cf update-user-provided-service common-messagehub -p "${JSON}" 
相關問題