Skip to content

Commit 87ab961

Browse files
mcbenjemaageoand
authored andcommitted
Enhance docs about setting Spring profile at bootstrap via ENV Variable (spring-cloud#408)
Fixes spring-cloudgh-403
1 parent 54e0ba8 commit 87ab961

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

docs/src/main/asciidoc/property-source-config.adoc

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,25 +183,35 @@ However, if the `production` profile is active, the configuration becomes:
183183
If both profiles are active, the property that appears last within the `ConfigMap` overwrites any preceding values.
184184

185185

186-
To tell Spring Boot which `profile` should be enabled at bootstrap, you can pass a system property to the Java
187-
command. To do so, you can launch your Spring Boot application with an environment variable that you can define with the OpenShift
188-
`DeploymentConfig` or Kubernetes `ReplicationConfig` resource file, as follows:
186+
To tell Spring Boot which `profile` should be enabled at bootstrap, you can pass `SPRING_PROFILES_ACTIVE` environment variable.
187+
To do so, you can launch your Spring Boot application with an environment variable that you can define it in the PodSpec at the container specification.
188+
Deployment resource file, as follows:
189189

190190
====
191191
[source,yaml]
192192
----
193-
apiVersion: v1
194-
kind: DeploymentConfig
193+
apiVersion: apps/v1
194+
kind: Deployment
195+
metadata:
196+
name: deployment-name
197+
labels:
198+
app: deployment-name
195199
spec:
196200
replicas: 1
197-
...
198-
spec:
199-
containers:
200-
- env:
201-
- name: JAVA_APP_DIR
202-
value: /deployments
203-
- name: JAVA_OPTIONS
204-
value: -Dspring.profiles.active=developer
201+
selector:
202+
matchLabels:
203+
app: deployment-name
204+
template:
205+
metadata:
206+
labels:
207+
app: deployment-name
208+
spec:
209+
containers:
210+
- name: container-name
211+
image: your-image
212+
env:
213+
- name: SPRING_PROFILES_ACTIVE
214+
value: "development"
205215
----
206216
====
207217

0 commit comments

Comments
 (0)