Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to append the already existing environment variable instead of overriding them #11803

Open
tejajagadeep opened this issue May 8, 2024 · 2 comments

Comments

@tejajagadeep
Copy link

Description

I can rewriting my application properties for my spring boot project in my docker compose I want to know how I can append to already existing file instead of overriding the properties.

wishlist-service:
    image: tejajagadeep/movie-app-wishlist-service:latest
    container_name: wishlist-container
    environment:
      - eureka.client.service-url.defaultZone=http://eureka-server:8761/eureka
      - spring.config.import=optional:configserver:http://config-server:8888/
      - management.zipkin.tracing.endpoint=http://zipkin-server:9411/api/v2/spans
      - swagger.server.url=http://localhost:8769/,http://localhost:4200/
      - spring.data.mongodb.uri=mongodb://root:root1234@mongodb:27017/wishlistdb?authSource=admin
    ports:
      - "8082:8082"
    networks:
      - my-network

I want to append this property instead of overwriting it.

- swagger.server.url=http://localhost:8769/,http://localhost:4200/, + values
@ndeloof
Copy link
Contributor

ndeloof commented May 13, 2024

I hardly can imagine a simple way to address this. Any suggestion ?

@neelp03
Copy link

neelp03 commented May 17, 2024

Have you tried entrypoint script? It can modify the server url just before the application starts, adding the extra values you need.
You can also try expanding env variables, but it might not be possible since it requires the env variable to be predefined in the shell. Also what about making an environment file where you specify all your environment variables?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants