此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Cloud Config 4.1.4! |
AWS S3 后端
Spring Cloud Config Server 支持将 AWS S3 作为配置属性的后端。 您可以通过向适用于 Amazon S3 的 AWS Java 开发工具包添加依赖项来启用此功能。
pom.xml
<dependencies>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
</dependency>
</dependencies>
以下配置使用 AWS S3 客户端访问配置文件。我们可以使用spring.cloud.config.server.awss3.*
properties 选择存储配置的存储桶。
spring:
profiles:
active: awss3
cloud:
config:
server:
awss3:
region: us-east-1
bucket: bucket1
还可以指定一个 AWS URL 来覆盖 S3 服务的标准终端节点spring.cloud.config.server.awss3.endpoint
.这允许支持 S3 的 beta 区域和其他与 S3 兼容的存储 API。
使用默认凭据提供程序链找到凭据。支持版本控制和加密的存储桶,无需进一步配置。
配置文件以{application}-{profile}.properties
,{application}-{profile}.yml
或{application}-{profile}.json
.可以提供可选标签来指定文件的目录路径。
未指定配置文件时default 将被使用。 |