Skip to content

Bash script to convert a file of properties in the Spring canonical-form into proper environment variables (particularly useful for using in a Kubernetes ConfigMap).

Notifications You must be signed in to change notification settings

grtrout/convert-spring-properties-to-env-vars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Convert Spring Properties to Env Vars

Bash script to convert a file of properties in the Spring canonical-form into proper environment variables (particularly useful for using in a Kubernetes ConfigMap).

Usage

./convert-spring-properties-to-env-vars.sh [file-to-convert]

E.g.:
./convert-spring-properties-to-env-vars.sh application.properties

Example

Given the following properties file:

greg@ubuntu:~$ cat application.properties
# Default port and app name
server.port=9003
spring.application.name = sample-app

# Actuator settings
management.endpoints.web.exposure.include=*
management.endpoints.web.base-path= /api/pkg/actuator
management.endpoint.health.probes.enabled=true

# Redis settings
spring.redis.host=127.0.0.1
spring.redis.port=15221

The converted output will be displayed to stdout (or redirected to a file using the > operator):

greg@ubuntu:~$ ./convert-spring-properties-to-env-vars.sh application.properties
SERVER_PORT: "9003"
SPRING_APPLICATION_NAME: "sample-app"
MANAGEMENT_ENDPOINTS_WEB_EXPOSURE_INCLUDE: "*"
MANAGEMENT_ENDPOINTS_WEB_BASEPATH: "/api/pkg/actuator"
MANAGEMENT_ENDPOINT_HEALTH_PROBES_ENABLED: "true"
SPRING_REDIS_HOST: "127.0.0.1"
SPRING_REDIS_PORT: "15221"

About

Bash script to convert a file of properties in the Spring canonical-form into proper environment variables (particularly useful for using in a Kubernetes ConfigMap).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages