Code Monkey home page Code Monkey logo

Comments (4)

jonasvinther avatar jonasvinther commented on September 3, 2024

Hi @Docjones,
Thank you for reaching out. I'm not a java developer so I don't know anything about spring boot cloud config. Can you elaborate a bit on how this setup up should look like?

from medusa.

Docjones avatar Docjones commented on September 3, 2024

Hello @jonasvinther,
sorry if i was unclear :) spring boot applications rely heavyly on configuration in form of (java) property files (see here). Typically, there are secrets like database connection strings stored within.

We want to import our property files into a vault server. spring-boot-cloud already allows us to retrieve the kv from a vault during boot. But we have several dozens of property files to migrate

from medusa.

hoeghh avatar hoeghh commented on September 3, 2024

You could do something like this :

Have a file java.properties with the following content

--- 
key: |-
    # You are reading the ".properties" entry.
    ! The exclamation mark can also mark text as comments.
    # The key characters =, and : should be written with
    # a preceding backslash to ensure that they are properly loaded.
    # However, there is no need to precede the value characters =, and : by a backslash.
    website = https://en.wikipedia.org/
    language = English
    # The backslash below tells the application to continue reading
    # the value onto the next line.
    message = Welcome to \
    	  Wikipedia!
    # But if the number of backslashes at the end of the line is even, the next line is not included in the value. In the following example, the value for "key" is "valueOverOneLine\"
    key = valueOverOneLine\\
    # This line is not included in the value for "key"
    # Add spaces to the key
    key\ with\ spaces = This is the value that could be looked up with the key "key with spaces".
    # The characters = and : in the key must be escaped as well:
    key\:with\=colonAndEqualsSign = This is the value for the key "key:with=colonAndEqualsSign"
    # Unicode
    tab : \u0009
    # If you want your property to include a backslash, it should be escaped by another backslash
    path=c:\\wiki\\templates
    # However, some editors will handle this automatically

Then import via

./medusa import secret/javaproject/properties java.properties -a="https://0.0.0.0:8201" -t="00000000-0000-0000-0000-000000000000" --insecure

Then export it again

echo -e $(./medusa export secret/javaproject/ -a="https://0.0.0.0:8201" -t="00000000-0000-0000-0000-000000000000" --format="json" --insecure | jq .javaproject.properties.key)

"# You are reading the \".properties\" entry.
! The exclamation mark can also mark text as comments.
# The key characters =, and : should be written with
# a preceding backslash to ensure that they are properly loaded.
# However, there is no need to precede the value characters =, and : by a backslash.
website = https://en.wikipedia.org/
language = English
# The backslash below tells the application to continue reading
# the value onto the next line.
message = Welcome to \
	 Wikipedia!
# But if the number of backslashes at the end of the line is even, the next line is not included in the value. In the following example, the value for \"key\" is \"valueOverOneLine\\"
key = valueOverOneLine\\
# This line is not included in the value for \"key\"
# Add spaces to the key
key\ with\ spaces = This is the value that could be looked up with the key \"key with spaces\".
# The characters = and : in the key must be escaped as well:
key\:with\=colonAndEqualsSign = This is the value for the key \"key:with=colonAndEqualsSign\"
# Unicode
tab : \u0009
# If you want your property to include a backslash, it should be escaped by another backslash
path=c:\\wiki\\templates
# However, some editors will handle this automatically"

The quotes could be removed with a sed command

from medusa.

jonasvinther avatar jonasvinther commented on September 3, 2024

This is a framework specific feature and therefore not something we intend to implement. @hoeghh has made a proposal on how it could work using Medusa. I'm closing this issue.

from medusa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.