You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/server/environment-repository.adoc
+20-4Lines changed: 20 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,17 +58,33 @@ spring:
58
58
59
59
WARNING: Enabling this feature allows the Config Server to read files from the local file system where the server is running. Ensure that the process has appropriate file system permissions and is running in a secure environment.
60
60
61
-
When this feature is enabled, you can use the `{file}` prefix in your configuration values followed by the path to the file.
61
+
==== Usage
62
+
63
+
You can use the `{file}` prefix in your configuration values followed by the path to the file.
62
64
The Config Server will read the file, encode its content to a Base64 string, and replace the property value.
63
65
64
-
For example, in your backing repository (e.g., Git or Native), you can define a property like this:
66
+
**1. Absolute Path**
67
+
68
+
You can reference files on the Config Server's local file system using an absolute path:
65
69
66
70
[source,yaml]
67
71
----
68
72
server:
69
73
ssl:
70
74
key-store: {file}/etc/certs/keystore.jks
71
-
key-password: my-secret-password
72
75
----
73
76
74
-
In this example, the Config Server reads `/etc/certs/keystore.jks`, encodes it, and returns the Base64 string as the value of `server.ssl.key-store`.
77
+
**2. Relative Path (Repository-aware)**
78
+
79
+
If you are using a repository that supports search paths (like Git, SVN, or Native), you can reference files **relative to the repository root** by starting the path with a dot (`.`):
80
+
81
+
[source,yaml]
82
+
----
83
+
server:
84
+
ssl:
85
+
# Resolves 'certs/keystore.jks' located inside the Git repository
86
+
key-store: {file}./certs/keystore.jks
87
+
----
88
+
89
+
In this case, the Config Server will look for the file inside the cloned repository directory.
90
+
If the repository does not support search paths (e.g., JDBC, Vault), relative paths will be ignored.
Copy file name to clipboardExpand all lines: spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/FileResolvingEnvironmentRepository.java
Copy file name to clipboardExpand all lines: spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/environment/FileResolvingEnvironmentRepositoryTests.java
0 commit comments