通过 manifest.yml 文件配置目录项 [英] Configuring catalog items through manifest.yml file

查看:37
本文介绍了通过 manifest.yml 文件配置目录项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 spring-cloud-cloudfoundry-service-broker,我们开发了一个 service broker.
最初我们在 application.yml 文件中定义了目录项,该文件捆绑在 jar 中,这一切都很好.

Using spring-cloud-cloudfoundry-service-broker we developed a service broker.
Initially we defined catalog items within application.yml file which gets bundled inside jar and this all works great.

我们考虑通过manifest.yml文件提供,而不是将目录项捆绑在jar文件中,同时将服务推送到cloud foundry.但不幸的是,应用程序没有获得 manigest.yml 文件中指定的目录项.您能否让我们知道我们如何通过 manifest.yml 文件提供目录项?

Instead of bundling catalog items within jar file, we thought of supplying through manifest.yml file while pushing the service to cloud foundry. But unfortunately application is not getting the catalog items specified in manigest.yml file. Could you please let us know how do we supply catalog items through manifest.yml file?

我在这里复制了我的代码片段.

I have copied my code snippet here.

CatalogConfig.java

@ConfigurationProperties(prefix = "catalog")
@Component
public class CatalogConfig {
private List<ServiceDefinitionProxy> services;

public CatalogConfig() {
    super();
}

@Bean
Catalog catalog() {
    return new Catalog(services.stream().map(s -> s.unproxy())
            .collect(Collectors.toList()));
}

public CatalogConfig(List<ServiceDefinitionProxy> services) {
    super();
    this.services = services;
}

public List<ServiceDefinitionProxy> getServices() {
    return services;
}

public void setServices(List<ServiceDefinitionProxy> services) {
    this.services = services;
}

public ServiceDefinitionProxy findServiceDefinition(String serviceId) {
    return services.stream().filter(s -> s.getId().equals(serviceId))
            .findFirst().get();
}
}    

Manifest.yml

---
applications:
- name: my-service-broker
  memory: 512M
  instances: 1
  host: my-service-broker
  path: target/my-service-broker-1.0.0-SNAPSHOT.jar
  env: 
    SPRING_PROFILES_DEFAULT: cloud
catalog:
    services:
      - id: f1478faa-d980-11e5-b5d2-0a1d41d68578
        name: api-marketpace
        description: API Marketplace
        bindable: true
        planUpdatable: true
        head-type: api
        tags:
          - api
          - Manage API Marketplace
        metadata:
          displayName: API Marketplace
          imageUrl: https://my-service-broker.cf.com/images/logo.PNG
          longDescription: API Marketplace.
          providerDisplayName: API Team
          documentationUrl: https://wikihub.com/display/ASC/Training
          supportUrl: https://wikihub.com/display/ASC/Training
        plans:
          - id: f1478faa-d980-11e5-b5d2-0a1d41d68579
            name: unlimited
            description: free
            metadata:
              costs:
                - amount:
                    usd: 0.00
                  unit: PER MONTH
              bullets:
                - Basic Unlimited
        dashboardClient:
          id: api-marketpace
          secret: secret
          redirectUrl: https://api.cf.com/

推荐答案

那行不通.

manifest.yml 文件仅由 cf CLI 以在将应用程序推送到 CF 时提供选项.已部署的应用程序永远不会看到此文件或其任何内容.事实上,CF 平台本身永远不会看到文件或其内容——它完全由客户端的 CLI 处理.

The manifest.yml file is used exclusively by the cf CLI to provide options when pushing apps to CF. Deployed applications never see this file or any of its contents. In fact the CF platform itself never sees the file or its contents - it is purely processed by the CLI on the client side.

application.yml 文件由 Spring Boot,内容通过@ConfigurationProperties等方式提供给应用.

The application.yml file is used by Spring Boot and the contents are provided to the app via @ConfigurationProperties and other means.

这是两个完全独立的概念和机制,都恰好使用了 YAML 数据格式.

These are two completely separate concepts and mechanisms, both of which happen to use the YAML data format.

这篇关于通过 manifest.yml 文件配置目录项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆