]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Handle postgresql sockets for cryptoportfolio app
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 4 May 2018 21:45:05 +0000 (23:45 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Fri, 4 May 2018 21:45:05 +0000 (23:45 +0200)
modules/role/manifests/cryptoportfolio.pp
modules/role/templates/cryptoportfolio/api_conf.toml.erb

index 966f549fa81e3a73b8334bd8662ebd3cb3ee448e..5aaaee3579ac669a20b9ac593317186f38fea938 100644 (file)
@@ -7,7 +7,7 @@ class role::cryptoportfolio (
   String            $pg_user,
   String            $pg_user_replication,
   String            $pg_db,
-  Optional[String]  $pg_hostname          = "localhost",
+  Optional[String]  $pg_hostname          = "/run/postgresql",
   Optional[String]  $pg_port              = "5432",
   Optional[String]  $redis_host           = "/run/redis/redis.sock",
   Optional[String]  $web_host             = undef,
index 63f39c77cdb6dc7e4b4c2b9ac98f08cf2bee5c92..d806778ad0b27b6aa962c7def7df6b35d3ece6a5 100644 (file)
@@ -6,7 +6,13 @@ log_out="stdout"
 user="<%= @pg_user %>"
 password="<%= @pg_password %>"
 database="<%= @pg_db %>"
-address="<%= @pg_host %>"
+<%- if @pg_hostname[0] == "/" -%>
+type="unix"
+address="<%= @pg_hostname %>/.s.PGSQL.<%= @pg_port %>"
+<%- else -%>
+type="tcp"
+address="<%= @pg_hostname %>:<%= @pg_port %>"
+<%- end -%>
 
 <%- if !@redis_host.nil? && @redis_host != "" -%>
 [redis]