Usually environment variables are used for this, perhaps with an .env
file that you source:
export DB_USER=fredrik
export DB_PASSWORD=*******
and then access as
db_user = ENV["DB_USER"]
db_password = ENV["DB_PASSWORD"]
Edit: Looks like Discourse automatically edits the post and insert *
s instead of my password. I typed DB_PASSWORD=hunter2
but it was edited.