java - 如何定义子文件夹以查找 jhipster 注册表的配置文件
问题描述
我刚刚运行了 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-registry 中的“复合事物”实现这种行为。有关信息,这是 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
解决方案
我正在将现有的旧 JHipster Registry 升级到 5.0.1。我也在使用 git repo。上述配置的问题是没有search-locations
为 git repo调用该属性search-paths
。为了使通过环境变量指定搜索路径的所有内容都像以前一样工作SPRING_CLOUD_CONFIG_SERVER_GIT_SEARCH-PATHS
,我在我的产品引导程序中使用以下配置。
引导-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-----
推荐阅读
- angularjs - AngularJS 为 MultiBar Chart NVD3 准备数据
- python - Dask 如何旋转 DataFrame
- ruby-on-rails - 如何在 Rails 5 控制器测试中测试或绕过 Basic Auth
- android - WorkManager - how to execute jobs sequentially
- laravel - Sum by cases using just Eloquent
- javascript - 迭代 document.getElementsByClassName
- html - CSS - Position outside div absolute relative to another
- webpack - 使用 webpack-dev-server 在 chrome 中调试:未捕获的引用错误,{variable} 未定义
- javascript - ASP.Net C# 不接收 ajax 数据
- excel - 1 分钟活动后的 VBA Excel 应用程序 OnTime