|
对于最新的稳定版本,请使用Spring Cloud Config 5.0.0! |
AWS S3 后端
Spring Cloud 配置服务器支持 AWS S3 作为配置属性的后端。 您可以通过在AWS Java SDK For Amazon S3中添加依赖来启用此功能。
pom.xml
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
</dependency>
</dependencies>
以下配置使用 AWS S3 客户端访问配置文件。我们可以使用Spring.cloud.config.server.awss3.*属性来选择存储配置的桶。
spring:
profiles:
active: awss3
cloud:
config:
server:
awss3:
region: us-east-1
bucket: bucket1
你也可以指定一个 AWS URL,覆盖你 S3 服务的标准端点Spring.cloud.config.server.awss3.endpoint.这使得支持 S3 的测试版区域以及其他兼容 S3 的存储 API。
凭证通过默认凭证提供者链(Default Credential Provider Chain)找到。支持版本化和加密桶,无需额外配置。
配置文件存储在您的桶中,格式为{application}-{profile}.properties,{application}-{profile}.yml或{application}-{profile}.json.可提供可选标签以指定文件的目录路径。
当没有指定配置文件时默认值将被使用。 |