# find DISCOURSE_ env vars, strip the leader, lowercase the key
/usr/local/bin/ruby -e 'ENV.each{|k,v| puts "#{$1.downcase} = #{v}" if k =~ /^DISCOURSE_(.*)/}' > $conf
+ - file:
+ path: /etc/runit/1.d/enable-brotli
+ chmod: "+x"
+ contents: |
+ #!/bin/bash
+ [ ! -z "$COMPRESS_BROTLI" ] && sed -i "s/. brotli/ brotli/" /etc/nginx/conf.d/discourse.conf || sed -i "s/. brotli/# brotli/" /etc/nginx/conf.d/discourse.conf
+
- file:
path: /etc/runit/1.d/ensure-web-nginx-read
chmod: "+x"
- "cp $home/config/nginx.sample.conf /etc/nginx/conf.d/discourse.conf"
- "rm /etc/nginx/sites-enabled/default"
- "mkdir -p /var/nginx/cache"
- - '/bin/bash -c ''([ ! -z "$COMPRESS_BROTLI"] && sed -i "s/# brotli/brotli/" /etc/nginx/conf.d/discourse.conf) || exit 0'''
- replace:
filename: /etc/nginx/nginx.conf