Make sure ssowat log file is created and exists when starting nginx/ssowat

This commit is contained in:
Alexandre Aubin 2019-10-03 20:42:48 +02:00
parent 1eb322df17
commit d71075dfed

View file

@ -8,6 +8,10 @@
-- another. -- another.
-- --
-- Path of the configuration
conf_path = "/etc/ssowat/conf.json"
log_file = "/var/log/nginx/ssowat.log"
-- Remove prepending '@' & trailing 'init.lua' -- Remove prepending '@' & trailing 'init.lua'
script_path = string.sub(debug.getinfo(1).source, 2, -9) script_path = string.sub(debug.getinfo(1).source, 2, -9)
@ -23,6 +27,11 @@ local socket = require "socket"
local config = require "config" local config = require "config"
lustache = require "lustache" lustache = require "lustache"
-- Make sure the log file exists and we can write in it
io.popen("touch "..log_file)
io.popen("chown www-data "..log_file)
io.popen("chmod u+w "..log_file)
-- Persistent shared table -- Persistent shared table
flashs = {} flashs = {}
i18n = {} i18n = {}
@ -54,8 +63,5 @@ for file in lfs.dir(locale_dir) do
end end
end end
-- Path of the configuration
conf_path = "/etc/ssowat/conf.json"
-- You should see that in your Nginx error logs by default -- You should see that in your Nginx error logs by default
ngx.log(ngx.INFO, "SSOwat ready") ngx.log(ngx.INFO, "SSOwat ready")