提供二进制文件

为了从配置服务器提供二进制文件,您需要发送一个值为 application/octet-streamAccept 请求头。

Git, SVN 和 Native 后端

考虑以下针对 GIT 或 SVN 仓库或 native 后端的示例

application.yml
nginx.conf

nginx.conf 可能类似于以下清单

server {
    listen              80;
    server_name         ${nginx.server.name};
}

application.yml 可能类似于以下清单

nginx:
  server:
    name: example.com
---
spring:
  profiles: development
nginx:
  server:
    name: develop.com

/sample/default/master/nginx.conf 资源可能如下所示

server {
    listen              80;
    server_name         example.com;
}

/sample/development/master/nginx.conf 可能如下所示

server {
    listen              80;
    server_name         develop.com;
}

AWS S3

要启用为 AWS S3 提供纯文本,Config Server 应用需要引入对 io.awspring.cloud:spring-cloud-aws-context 的依赖。有关如何设置此依赖的详细信息,请参阅 Spring Cloud AWS 参考指南。此外,将 Spring Cloud AWS 与 Spring Boot 一起使用时,引入自动配置依赖非常有用。然后您需要配置 Spring Cloud AWS,具体方法如 Spring Cloud AWS 参考指南所述。

解密纯文本

默认情况下,纯文本文件中的加密值不会被解密。为了启用纯文本文件的解密,请在 bootstrap.[yml|properties] 中设置 spring.cloud.config.server.encrypt.enabled=truespring.cloud.config.server.encrypt.plainTextEncrypt=true

纯文本文件的解密仅支持 YAML, JSON 和 properties 文件扩展名。

如果启用此功能,并且请求了不支持的文件扩展名,则文件中的任何加密值将不会被解密。