Support DBD::Pg default for "host" field as local socket
This commit is contained in:
		| @@ -20,6 +20,7 @@ | ||||
|   * [#60] Incorrect format string in store_vlans (Robert Kerr) | ||||
|   * Fix form reset icon on ports tab when using custom path (Daniel Tuecks) | ||||
|   * Don't store failed SNMP community in the database | ||||
|   * [#51] Support DBD::Pg default for "host" field as local socket | ||||
|  | ||||
| 2.020002 - 2013-12-11 | ||||
|  | ||||
|   | ||||
| @@ -45,14 +45,17 @@ use Dancer ':script'; | ||||
|  | ||||
| if (ref {} eq ref setting('database')) { | ||||
|     my $name = (setting('database')->{name} || 'netdisco'); | ||||
|     my $host = (setting('database')->{host} || 'localhost'); | ||||
|     my $user = (setting('database')->{user}); | ||||
|     my $pass = (setting('database')->{pass}); | ||||
|     my $host = setting('database')->{host}; | ||||
|     my $user = setting('database')->{user}; | ||||
|     my $pass = setting('database')->{pass}; | ||||
|  | ||||
|     my $dsn = "dbi:Pg:dbname=${name}"; | ||||
|     $dsn .= ";host=${host}" if $host; | ||||
|  | ||||
|     # set up the netdisco schema now we have access to the config | ||||
|     # but only if it doesn't exist from an earlier config style | ||||
|     setting('plugins')->{DBIC}->{netdisco} ||= { | ||||
|         dsn => (sprintf 'dbi:Pg:dbname=%s;host=%s', $name, $host), | ||||
|         dsn  => $dsn, | ||||
|         user => $user, | ||||
|         pass => $pass, | ||||
|         options => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user