diff --git a/init.lua b/init.lua index d4efe1f..6993e53 100644 --- a/init.lua +++ b/init.lua @@ -8,6 +8,10 @@ -- another. -- +-- Path of the configuration +conf_path = "/etc/ssowat/conf.json" +log_file = "/var/log/nginx/ssowat.log" + -- Remove prepending '@' & trailing 'init.lua' script_path = string.sub(debug.getinfo(1).source, 2, -9) @@ -23,6 +27,11 @@ local socket = require "socket" local config = require "config" 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 flashs = {} i18n = {} @@ -54,8 +63,5 @@ for file in lfs.dir(locale_dir) do end end --- Path of the configuration -conf_path = "/etc/ssowat/conf.json" - -- You should see that in your Nginx error logs by default ngx.log(ngx.INFO, "SSOwat ready")