Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,31 @@ The preceding listing matches objects stored in your bucket in `/\{application}`
│ ├── application-test.yml
│ └── application.yml
```

[[search-paths]]
== Search paths

Spring Cloud Config Server also supports `search-paths` for the AWS S3 backend, analogous to xref:./git-backend.adoc#placeholders-in-git-search-paths[`search-paths`] in the Git backend. You can specify a list of paths in the bucket to search for configuration files. The search paths can contain placeholders like `{application}`, `{profile}`, and `{label}`.

The search paths support:
- *Literal paths*: Probing exact paths with supported file extensions (e.g. `properties`, `json`, `yml`, `yaml`).
- *Directory paths*: Scanning files under a specific directory.
- *Wildcards*: Patterns with `*` or `?` placeholders (e.g. `config/*`).

The following configuration specifies search paths in the S3 bucket:

[source,yaml]
----
spring:
cloud:
config:
server:
awss3:
region: us-east-1
bucket: bucket1
search-paths:
- '{application}'
- 'config/{application}'
- 'settings/*'
----

Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@

package org.springframework.cloud.config.server.environment;

import java.util.Collections;
import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.config.server.support.EnvironmentRepositoryProperties;

/**
* @author Clay McCoy
* @author Geonwook Ham
*/
@ConfigurationProperties("spring.cloud.config.server.awss3")
public class AwsS3EnvironmentProperties implements EnvironmentRepositoryProperties {
Expand All @@ -41,13 +45,28 @@ public class AwsS3EnvironmentProperties implements EnvironmentRepositoryProperti
private String bucket;

/**
* Use application name as intermediate directory. Analogous to `searchPaths:
* {application}` from Git backend.
* Use application name as intermediate directory. Analogous to
* {@link #searchPaths}
* from Git backend.
*/
private boolean useDirectoryLayout;

private int order = DEFAULT_ORDER;

/**
* List of directory paths to search for profiles in the bucket.
* Analogous to {@link #searchPaths} in Git backend.
*/
private List<String> searchPaths = Collections.emptyList();

public List<String> getSearchPaths() {
return searchPaths;
}

public void setSearchPaths(List<String> searchPaths) {
this.searchPaths = searchPaths;
}

public String getRegion() {
return region;
}
Expand Down
Loading