Show authelia status.

This commit is contained in:
Fabian Schlenz 2022-10-27 15:03:52 +02:00
parent 3af1ffa11a
commit e2bd375198

16
dps.rb
View File

@ -9,7 +9,7 @@ COLOR_GRAY = ""
COLOR_RESET = "" COLOR_RESET = ""
class Container class Container
FIELDS = [:state, :dup, :ouroboros, :name, :vhosts, :nginx_allow, :status, :image, :ports] FIELDS = [:state, :dup, :ouroboros, :name, :vhosts, :authelia, :status, :image, :ports]
@@lengths = Hash.new(0) @@lengths = Hash.new(0)
def initialize(data) def initialize(data)
@ -47,7 +47,19 @@ class Container
end end
end.uniq.join(" ") end.uniq.join(" ")
set :nginx_allow, @data[:Labels][:"nginx_allow"] #set :nginx_allow, @data[:Labels][:"nginx_allow"]
if vh==""
set :authelia, ""
elsif @data[:Labels][:"authelia_policy"]=="one_factor"
set :authelia, "1#{COLOR_GRAY}FA#{COLOR_RESET}"
elsif @data[:Labels][:"authelia_policy"]=="two_factor"
set :authelia, "2#{COLOR_GRAY}FA#{COLOR_RESET}"
elsif @data[:Labels][:"authelia_policy"]=="bypass"
set :authelia, "#{COLOR_GREEN}BYP#{COLOR_RESET}"
else
set :authelia, "#{COLOR_RED}?#{COLOR_RESET}"
end
st = @data[:Status] st = @data[:Status]
if st.end_with?("(healthy)") if st.end_with?("(healthy)")
st = COLOR_GREEN + st.gsub("(healthy)", "(v)") + COLOR_RESET st = COLOR_GREEN + st.gsub("(healthy)", "(v)") + COLOR_RESET