Skip to content

Instantly share code, notes, and snippets.

@juliettegodyere
Created April 13, 2024 18:43
Show Gist options
  • Select an option

  • Save juliettegodyere/3b263d16942bb3cfe3fb66307a02715f to your computer and use it in GitHub Desktop.

Select an option

Save juliettegodyere/3b263d16942bb3cfe3fb66307a02715f to your computer and use it in GitHub Desktop.

Revisions

  1. juliettegodyere revised this gist Apr 13, 2024. No changes.
  2. juliettegodyere created this gist Apr 13, 2024.
    24 changes: 24 additions & 0 deletions Spring Cloud Config Server
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    ## I've implemented a Microservice architecture where I've leveraged Spring Cloud Config Server for managing externalized configurations. To ensure the security of sensitive data, I needed a solution for encrypting and decrypting configurations before storing them on GitHub. Fortunately, Spring Cloud Config Server offers robust encryption and decryption capabilities out of the box.

    Here's how I implemented encryption using the Symmetric key method:

    Generated a 32-character alphanumeric encryption key.
    Added the encryption key to my configServer-service application.properties file:

    `encrypt.key = ${ENCRYPT_KEY}`

    Note: ${ENCRYPT_KEY} references the value stored in the 'ENCRYPT_KEY' environmental variable.

    Encrypted sensitive data using the command:
    `curl localhost:8888/encrypt -d 'my-sensitive-password`

    Updated my Microservices configurations stored on GitHub using the Config Server to include:
    `spring.datasource.password={cipher}encrypted-value`

    For detailed guidance, I found the following resources invaluable:

    https://medium.com/@karthi32.mail/spring-cloud-config-server-encryption-and-decryption-using-git-repository-d8d1a7a1e6eb
    https://docs.spring.io/spring-cloud-config/docs/current/reference/html/#_encryption_and_decryption
    https://www.youtube.com/watch?v=FRrcewwT6bY

    These references provided comprehensive insights into effectively managing secure configurations with Spring Cloud Config Server.