Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert YAML file to Application.properties [closed]

How can we convert YAML file to Application.properties?

pay.payment:
  sandbox:
   Url: https://securegw-stage//processTransaction
    callbackUrl: http://localhost:8080/pgresponse
    details:
      CHANNEL_ID: '${pay.payment.sandbox.channelid}'
      INDUSTRY_TYPE_ID: '${pay.payment.sandbox.industrytypeid}'
      CALLBACK_URL: '${pay.payment.sandbox.callbackUrl}'

Is there any tool to convert YAML to app.properties online?

like image 321
Myjay1516 Avatar asked Nov 12 '18 10:11

Myjay1516


People also ask

Is application yml same as application properties?

Unlike properties files, YAML supports multi-document files by design, and this way, we can store multiple profiles in the same file no matter which version of Spring Boot we use. Note: We usually don't want to include both the standard application.


2 Answers

I dealt with the same problem using a python script.

Just clone and run:

$ python yaml2props.py {your_path_file}

Note

In my specific case on Ubuntu 18.04, I had to install pyperclip library and use python3, so:

$ pip3 install pyperclip
$ python3 yaml2props.py {your_path_file}
like image 139
Reginaldo Santos Avatar answered Sep 30 '22 04:09

Reginaldo Santos


The yml is a tree, to convert to a properties you just need the extra boilerplate of the preceding hierarchy e.g.

pay.payment.sandbox.url=https://securegw-stage//processTransaction
pay.payment.sandbox.callbackurl=http://localhost:8080/pgresponse
pay.payment.sandbox.details.CHANNEL_ID='${pay.payment.sandbox.channelid}'
pay.payment.sandbox.details.INDUTRY_TYPE_ID='${pay.payment.sandbox.industrytypeid}'
pay.payment.sandbox.details.CALLBACK_URL='${pay.payment.sandbox.callbackUrl}'
like image 34
Darren Forsythe Avatar answered Sep 30 '22 02:09

Darren Forsythe