Convert YAML file to Application.properties [closed]

与世无争的帅哥 提交于 2020-08-05 05:47:11

问题


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?


回答1:


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}'



回答2:


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}


来源:https://stackoverflow.com/questions/53260391/convert-yaml-file-to-application-properties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!