How to use Vault to check the .env files on the server

From PheonixSolutions
Jump to navigation Jump to search

How to use Vault to check the .env files on the server

Prerequisite

  1. Server root login credentials.

Step1:

    Login into the Jenkins server 

Step2:

Setting an Environment Variable: You can use the export command to set the value of an environment variable.

 export VAULT_ADDR=https://vault.pheonixsolutions.com

Step3:

Login into the vault using the below command 

 vault login hvs.sVSsmi7weDE8LjOkf6atDKzF

Step4:

List down the kV list in the vault 

 vault list kv

Step5:

Need to install Jq so use the below command in the Ubuntu server

 sudo apt install jq

Step6:
use the below command it shows the .env format in the server 

 vault kv get -format=json internal/dsmv1stagingapi.milta.be | jq -r '.data.data | to_entries | map("\(.key)=\(.value)")[]' | sed 's/:/=/g'