Last active
December 15, 2015 12:59
-
-
Save jadeallenx/5264113 to your computer and use it in GitHub Desktop.
Generate pool stanzas for erl.config files. Use with https://github.com/dizzyd/erlang-mysql-driver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use 5.010; | |
my $user = 'root'; | |
my $pass = 'pass'; | |
my $host = '10.1.2.3'; | |
my $port = '3306'; | |
my %names = ( | |
pool1 => 'db_foo', | |
pool2 => 'db_bar', | |
); | |
my $pool_stanza = qq| | |
{pool, '%s', | |
[{connection, | |
{max, 2}, | |
{database, "%s"}, | |
{host, "$host"}, | |
{port, $port}, | |
{user, "$user"}, | |
{password, "$pass"} | |
}] | |
}|; | |
say join ",", map { sprintf ($pool_stanza, $_, $names{$_}) } sort keys %names; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment