samples/consul-ui/common/header.html.erb in consul-templaterb-1.2.1 vs samples/consul-ui/common/header.html.erb in consul-templaterb-1.3.0

- old
+ new

@@ -1,17 +1,30 @@ <% # This template can be configure the following way with environment variables # CONSUL_TOOLS_SUFFIX: suffix for the address of consul tools # CONSUL_TOOLS_PREFIX: prefix for the address of consul tools # CONSUL_TOOLS: comma sperated list of consul tools - tools = (ENV['CONSUL_TOOLS'] || 'services').split(",") + tools = (ENV['CONSUL_TOOLS'] || 'services,nodes,keys').split(",") tools_suffix = ENV['CONSUL_TOOLS_PREFIX'] || '-ui.html' tools_prefix = ENV['CONSUL_TOOLS_SUFFIX'] || 'consul-' dc_suffix = ENV['CONSUL_DC_SUFFIX'] || '' dc_prefix = ENV['CONSUL_DC_PREFIX'] || '#' + # CUSTOM_LINKS: A comma separated list of URLs to add to the header in the format: [linkname](actuallink) + # Example: [Consul template erb](https://github.com/criteo/consul-templaterb),[anotherlink](#) + custom_links = (ENV['CUSTOM_LINKS'] || '').split(",") + links_to_display = {} + if !custom_links.empty? + custom_links.each do |link| + if /\[.*\]\(.*\)/ =~ link + link_data = /\[(.*)\]\((.*)\)/.match(link) + links_to_display[link_data[1]] = link_data[2] + end + end + end + %><!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/> @@ -19,10 +32,11 @@ <meta name="author" content="Criteo"/> <title><%= param('title', 'Consul Real Time information') %></title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.11/css/all.css" integrity="sha384-p2jx59pefphTFIpeqCcISO9MdVfIm4pNnsL08A6v5vaQc4owkQqxMV8kg4Yvhaw/" crossorigin="anonymous"> <link rel="stylesheet" href="css/style.css"> + <link rel="stylesheet" href="vendors/highlight/atom-one-dark.css"> <style id="css-states"> .service-tags { display: none; } </style> </head> <body> @@ -40,9 +54,14 @@ </div> </li> <% tools.each do |tool| %> <li class="nav-item"> <a class="nav-link" href="<%= tools_prefix + tool + tools_suffix %>"><%= tool.gsub('_', ' ').capitalize %></a> + </li> + <% end %> + <% links_to_display.each do |linkname,link| %> + <li class="nav-item"> + <a class="nav-link" target="_blank" href="<%= link %>"><%= linkname %></a> </li> <% end %> </ul> </div> </nav>