Skip to main content

Posts

Featured

Reformatting a php.ini file with Sublime Text 3 for use with Ansible

So quite a specific post this...

PHP .env files are of the format

KEY_A=true
KEY_B="This Is Another Value"

To set variables for use with a Jinja2 template they need to be something along the lines of

key_a: true
key_b: ThisIsAnotherValue

In Sublime Text in the replace all (CTRL+H)
Make sure that regex matching is on and not to preserve case.

Find What: (.+)=(.+)
Replace With: \L$1\E: $2

This will replace two groups of one or more characters. The first will be lowercased, the equals replaced with a colon and then the second group in its original case.

Then the original .env file can have the following in the Jinja2 template

KEY_A={{key_a}}
KEY_B={{key_b}}

Latest posts

Useful Vagrant plugins

Vagrant not working after fresh Windows 10 x64 install

Occasionally making phpunit work with PhpStorm and homestead

Making node / npm / gulp / elixir work for Laravel using Homestead on Vagrant with Virtualbox on Windows

Introducing ASP.NET 5

New Windows 10 build 9933 coming?

Windows 10 Pro Technical Preview Build 9926

Enabling SNMP on an ASUS RT-N66U

Installing VMware tools under Centos 7

Realtek HD Audio speakers and headphones with separate volume