@@ -11,17 +11,18 @@ instances:
1111# - optional_tag1
1212# - optional_tag2
1313#
14- - host: <%= @host %>
15- port: <%= @port %>
16- username: <%= @username %>
17- password: <%= @password %>
18- dbname: <%= @dbname %>
19- <% if @use_psycopg2 == true -%>
14+ <%- (Array(@_instances)).each do |instance| -%>
15+ - host: <%= instance['host'] %>
16+ port: <%= instance['port'] %>
17+ username: <%= instance['username'] %>
18+ password: <%= instance['password'] %>
19+ dbname: <%= instance['dbname'] %>
20+ <% if instance['use_psycopg2'] == true -%>
2021 use_psycopg2: true
2122<% end -%>
22- <% if @ tags and ! @ tags.empty? -%>
23+ <% if instance[' tags'] and ! instance[' tags'] .empty? -%>
2324 tags:
24- <%- Array(@ tags).each do |tag| -%>
25+ <%- Array(instance[' tags'] ).each do |tag| -%>
2526 <%- if tag != '' -%>
2627 - <%= tag %>
2728 <%- end -%>
@@ -37,9 +38,9 @@ instances:
3738# relations:
3839# - my_table
3940# - my_other_table
40- <% if @ tables and ! @ tables.empty? -%>
41+ <% if instance[' tables'] and ! instance[' tables'] .empty? -%>
4142 relations:
42- <%- Array(@ tables).each do |table| -%>
43+ <%- Array(instance[' tables'] ).each do |table| -%>
4344 <%- if table != '' -%>
4445 - <%= table %>
4546 <%- end -%>
@@ -57,9 +58,9 @@ instances:
5758# - [name, name] # captures the content of the "name" column as a tag for the 2 metrics defined
5859# - [address, localisation] # captures the content of "address" column as a tag and renames this tag "localisation"
5960#
60- <% if @ custom_metrics and ! @ custom_metrics.empty? -%>
61+ <% if instance[' custom_metrics'] and ! instance[' custom_metrics'] .empty? -%>
6162 custom_metrics:
62- <%- Array(@ custom_metrics).each do |n, custom_metric| -%>
63+ <%- Array(instance[' custom_metrics'] ).each do |n, custom_metric| -%>
6364 - query: <%= custom_metric["query"] %>
6465 relation: <%= custom_metric["relation"]? "true" : "false" %>
6566 metrics:
@@ -76,3 +77,4 @@ instances:
7677 <%- end -%>
7778 <%- end -%>
7879<% end -%>
80+ <% end -%>
0 commit comments