如何定义子文件夹以查找Jhipster注册表的配置文件

时间:2019-04-16 15:59:01

标签: java spring-boot jhipster jhipster-registry

我刚运行了jhipster注册表,它的运行正常。它正在从central-config文件夹中寻找配置文件。我想在Central-config文件夹本身的文件夹下重构我的配置文件。我可以通过这样的配置来运行Spring Cloud Config服务器:

spring:
       cloud:
            config:
                   server:
                         git:
                            default-label: develop
                            uri: file://${user.home}/config-repo
                            search-paths: employee-service, enterprise-service

如何在jhipster注册表中使用“复合物”实现这种行为。有关信息,这是jhipster注册表中的bootstrap.yml文件:

# ===================================================================
# Spring Cloud Config bootstrap configuration for the "dev" profile
# In prod profile, properties will be overwriten by the ones defined in bootstrap-prod.yml
# ===================================================================

spring:
    application:
        name: jhipster-registry
    profiles:
        active: dev
        include: composite
    cloud:
        config:
            server:
                bootstrap: true
                composite:
                    - type: native
                      search-locations: file:./central-config
                     #search-locations: file://${user.home}/Acensi/isupplier/config-repo

                prefix: /config
            fail-fast: true
            # name of the config server's property source (file.yml) that we want to use
            name: jhipster-registry
            profile: dev # profile(s) of the property source
            label: master # toggle to switch to a different version of the configuration as stored in git
            # it can be set to any label, branch or commit of the config source git repository

info:
    project:
        version: #project.version#

# uncomment to enable encryption features
#encrypt:
#    key: my-secret-encryption-key-to-change-in-production

2 个答案:

答案 0 :(得分:0)

我有同样的问题。我在application.yml文件中添加了以下内容:

spring:
  cloud:
    config:
      server:
        bootstrap: true
        composite:
          - type: native
            search-locations: file:./central-config/myFolder

您非常亲密,希望能对您有所帮助。

答案 1 :(得分:0)

我正在将现有的较旧的JHipster注册表升级到5.0.1。我也在使用git repo。上述配置的问题在于,对于git repo,该属性未称为search-locations,而该属性未称为search-paths。为了使所有操作都像以前那样通过环境变量SPRING_CLOUD_CONFIG_SERVER_GIT_SEARCH-PATHS指定搜索路径,我在产品引导程序中使用了以下配置。

bootstrap-prod.yml:

spring:
    cloud:
        config:
            server:
                bootstrap: true
                composite:
                    - type: git
                    uri: git@bitbucket.org:whatever/repo
                    search-paths: ${spring.cloud.config.server.git.search-paths}
                    ignore-local-ssh-settings: true
                    private-key: |
                      -----BEGIN RSA PRIVATE KEY-----