Don't fail on first run, when Tor hostname missing
This commit is contained in:
parent
ad64bfc0be
commit
8a870f6fd6
@ -24,6 +24,8 @@ template "#{node['nginx']['dir']}/snippets/mastodon.conf" do
|
||||
notifies :reload, 'service[nginx]', :delayed
|
||||
end
|
||||
|
||||
onion_address = File.read("/var/lib/tor/mastodon/hostname").strip rescue nil
|
||||
|
||||
template "#{node['nginx']['dir']}/sites-available/#{server_name}" do
|
||||
source 'nginx_conf_mastodon.erb'
|
||||
owner 'www-data'
|
||||
@ -32,7 +34,7 @@ template "#{node['nginx']['dir']}/sites-available/#{server_name}" do
|
||||
ssl_cert: "/etc/letsencrypt/live/#{server_name}/fullchain.pem",
|
||||
ssl_key: "/etc/letsencrypt/live/#{server_name}/privkey.pem",
|
||||
shared_config_path: "#{node['nginx']['dir']}/snippets/mastodon.conf",
|
||||
onion_address: File.read("/var/lib/tor/mastodon/hostname").strip
|
||||
onion_address: onion_address
|
||||
notifies :reload, 'service[nginx]', :delayed
|
||||
end
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
<% if @onion_address %>
|
||||
server {
|
||||
listen 80;
|
||||
server_name mastodon.<%= @onion_address %>;
|
||||
include <%= @shared_config_path %>;
|
||||
}
|
||||
<% end %>
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
|
Loading…
x
Reference in New Issue
Block a user