Skip to content

Commit

Permalink
Add dummy server to Nginx config when no server defined
Browse files Browse the repository at this point in the history
  • Loading branch information
hjr265 committed Jun 17, 2021
1 parent d5d375e commit 8ea33d9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions feline/nginx/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ upstream {{.Balancer.Id.Hex}} {
ip_hash;
{{end}}
{{if eq (len .Balancer.Servers) 0}}
server 127.0.0.1:80 down;
{{end}}
{{range $srv := .Balancer.Servers}}
server {{$srv.Settings.Address}} weight={{$srv.Settings.Weight}} {{if eq $srv.Settings.Availability "available"}}{{else if eq $srv.Settings.Availability "backup"}}backup{{else if eq $srv.Settings.Availability "unavailable"}}down{{end}};
{{end}}
Expand Down

0 comments on commit 8ea33d9

Please sign in to comment.