Sha256: d9bde742047a4f9dc909b968092d67f7f4a1b6c3f051ce3646fb9d82d92a8532

Contents?: true

Size: 866 Bytes

Versions: 19

Compression:

Stored size: 866 Bytes

Contents

<%
  # This example show how to display local time informaition about changes
  # Example of usage to display logs of changes on nodes() endpoint:
  #
  #   consul-templaterb --template "display_timestamped_changes.txt.erb:display_timestamped_changes.txt:cat display_timestamped_changes.txt" -l error
  #
  # Would output:
  #   Last update: 1588800554 (2020-05-06 21:29:14 UTC), X-Consul-Index: 4345827328
  #   Last update: 1588800569 (2020-05-06 21:29:29 UTC), X-Consul-Index: 4345829548
  #   Last update: 1588800676 (2020-05-06 21:31:16 UTC), X-Consul-Index: 4345836342
  #
  @my_last_time = Time.now.utc unless @my_last_time
  val = nodes()
  new_idx = val.endpoint.x_consul_index
  @my_last_time = Time.now.utc if @my_last_idx != new_idx
  @my_last_idx = new_idx
%>Last update: <%= @my_last_time.to_i %> (<%= @my_last_time %>), X-Consul-Index: <%= new_idx %>

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
consul-templaterb-1.36.1 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.35.1 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.34.1 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.33.3 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.33.2 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.33.1 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.33.0 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.32.1 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.32.0 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.31.1 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.31.0 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.30.0 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.29.0 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.28.2 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.28.1 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.28.0 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.27.2 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.27.1 samples/display_timestamped_changes.txt.erb
consul-templaterb-1.27.0 samples/display_timestamped_changes.txt.erb