When following 12 factor rule, where do I store configs?
Asked Answered
K

3

3

Here is the link 12 factor

I am confused weather if I should store values inside my app.properties file vs environment variable.

App.properties

Memory_Folder_Test = Test
Memory_Folder_Prod = Production
Memory_Folder_Dev = Development

Strong_threshold = 10
Low_Threshold = 2

Username = FirstUser
Password = PasswordSecret

So theoretically where should I put these values in? application.properties or as environment variables? If I did not read wrong the purpose of 12 factor is to remove putting values in properties file and externalize it.

Kirsch answered 20/6, 2017 at 14:48 Comment(0)
M
1

You can store the values in application.properties file, however, spring allows you to override those values using environment variables. Hence, it is a 12 factor compliant.

Mungovan answered 17/8, 2018 at 8:48 Comment(0)
K
0

You store the properties externally using something like spring cloud config. You then use the environment properties to define the configurations (like the url) needed to access cloud config from your applications

Koppel answered 20/6, 2017 at 16:23 Comment(1)
Would I need spring cloud config server or client?Kirsch
C
0

I prefer to store environment variables in files, encrypt the files and check the encrypted files into git, via blackbox: https://github.com/StackExchange/blackbox

Blackbox will handle encryption/decryption so that it makes it rather difficult to check the unencrypted creds into your repo. Also, the way openpgp works, you can enable teams of devs to encrypt/decrypt the files.

That project is maintained by StackExchange (aka the guys who run this site). It takes some time figuring out openpgp/gpg (which blackbox depends on), but it has been well worth it for me. I've been using in linux and also in windows (via the windows linux subsystem).

Catholic answered 18/4, 2018 at 2:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.