Added back before_restart to write a secrets file