|
6 | 6 | <% if scope.lookupvar("foreman_proxy::plugin::container_gateway::sqlite_timeout") -%> |
7 | 7 | :sqlite_timeout: <%= scope.lookupvar("foreman_proxy::plugin::container_gateway::sqlite_timeout") %> |
8 | 8 | <% end -%> |
9 | | -<% if scope.lookupvar('foreman_proxy::plugin::container_gateway::database_backend') == 'postgres' -%> |
10 | | -:db_connection_string: <%= [ |
11 | | - scope.lookupvar('foreman_proxy::plugin::container_gateway::database_backend'), |
12 | | - '://', |
13 | | - scope.lookupvar('foreman_proxy::plugin::container_gateway::postgresql_user'), |
14 | | - ':', |
15 | | - scope.lookupvar('foreman_proxy::plugin::container_gateway::postgresql_password'), |
16 | | - '@', |
17 | | - scope.lookupvar('foreman_proxy::plugin::container_gateway::postgresql_host'), |
18 | | - ':', |
19 | | - scope.lookupvar('foreman_proxy::plugin::container_gateway::postgresql_port'), |
20 | | - '/', |
21 | | - scope.lookupvar('foreman_proxy::plugin::container_gateway::postgresql_database') |
22 | | -].join %> |
23 | | -<% end -%> |
24 | | -<% if scope.lookupvar("foreman_proxy::plugin::container_gateway::database_backend") == 'sqlite' -%> |
25 | | -:db_connection_string: <%= |
26 | | - "#{scope.lookupvar("foreman_proxy::plugin::container_gateway::database_backend")}://" \ |
27 | | - "#{scope.lookupvar("foreman_proxy::plugin::container_gateway::sqlite_db_path")}" |
28 | | - %> |
29 | | -<% end -%> |
| 9 | +<%- |
| 10 | +case scope.lookupvar('foreman_proxy::plugin::container_gateway::database_backend') |
| 11 | +when 'postgres' |
| 12 | + uri = URI("postgres://") |
| 13 | + uri.user = scope.lookupvar('foreman_proxy::plugin::container_gateway::postgresql_user') |
| 14 | + uri.password = scope.lookupvar('foreman_proxy::plugin::container_gateway::postgresql_password') |
| 15 | + uri.host = scope.lookupvar('foreman_proxy::plugin::container_gateway::postgresql_host') |
| 16 | + uri.port = scope.lookupvar('foreman_proxy::plugin::container_gateway::postgresql_port') |
| 17 | + uri.path = "/#{scope.lookupvar('foreman_proxy::plugin::container_gateway::postgresql_database')}" |
| 18 | +when 'sqlite' |
| 19 | + uri = "sqlite://#{scope.lookupvar('foreman_proxy::plugin::container_gateway::sqlite_db_path')}" |
| 20 | +end |
| 21 | +-%> |
| 22 | +:db_connection_string: <%= uri %> |
0 commit comments