Serving Binary Files

为了从配置服务器提供二进制文件,你需要发送 Accept 标头 application/octet-stream

In order to serve binary files from the config server you will need to send an Accept header of application/octet-stream.

Git, SVN, and Native Backends

请考虑 GIT 或 SVN 存储库或本机后端的以下示例:

Consider the following example for a GIT or SVN repository or a native backend:

application.yml
nginx.conf

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

The nginx.conf might resemble the following listing:

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

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

application.yml might resemble the following listing:

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

/sample/default/master/nginx.conf 资源可能是这样的:

The /sample/default/master/nginx.conf resource might be as follows:

server {
    listen              80;
    server_name         example.com;
}

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

/sample/development/master/nginx.conf might be as follows:

server {
    listen              80;
    server_name         develop.com;
}

AWS S3

为了支持为 AWS s3 提供纯文本,Config Server 应用程序需要包含对 io.awspring.cloud:spring-cloud-aws-context 的依赖关系。有关如何设置该依赖关系的详细信息,请参阅 Spring Cloud AWS Reference Guide。此外,在将 Spring Cloud AWS 与 Spring Boot 结合使用时,包含 auto-configuration dependency 会很有用。然后,您需要配置 Spring Cloud AWS,如 Spring Cloud AWS Reference Guide 所述。

To enable serving plain text for AWS s3, the Config Server application needs to include a dependency on io.awspring.cloud:spring-cloud-aws-context. For details on how to set up that dependency, see the Spring Cloud AWS Reference Guide. In addition, when using Spring Cloud AWS with Spring Boot it is useful to include the auto-configuration dependency. Then you need to configure Spring Cloud AWS, as described in the Spring Cloud AWS Reference Guide.

Decrypting Plain Text

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

By default, encrypted values in plain text files are not decrypted. In order to enable decryption for plain text files, set spring.cloud.config.server.encrypt.enabled=true and spring.cloud.config.server.encrypt.plainTextEncrypt=true in bootstrap.[yml|properties]

仅支持 YAML、JSON 和属性文件扩展的纯文本文件解密。

Decrypting plain text files is only supported for YAML, JSON, and properties file extensions.

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

If this feature is enabled, and an unsupported file extention is requested, any encrypted values in the file will not be decrypted.