简体   繁体   中英

How to add environment variable value to YAML file?

I'm having .env file. which contains:

User_Name= username
Pass_Word= password

How to add the above variable values username and password only to the yaml.

I mentioned in this way:

Website:
   USER:
     Login: ${User_Name}
     Pass: ${Pass_Word}

Expected Result while parsed in python file:

Login = username
Pass = password

But I'm getting strings like below while I actually need to get username and password :

Login = '${User_Name}'
Pass = '${Pass_Word}'

As I understand you need configuration like this:

username: "username"
password: "password"

website:
  user:
    login: ${username}
    pass: ${password}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM