Commit 366e1db3 authored by Todd Evanoff's avatar Todd Evanoff

add logging configuration

parent 4c40e66b
......@@ -53,6 +53,22 @@ For SEO purposes, you can drop the `.html` extension from URLs for say a blog si
By default this is set to `false`.
#### Logging
You can disable the access log and change the severity level for the error log.
```json
{
"logging": {
"access": false,
"error": "warn"
}
}
```
By default `access` is set to `true` and `error` is set to `error`.
#### Custom Routes
You can define custom routes that combine to a single file. This allows you to preserve routing for a single page web application. The following operators are supported:
......
......@@ -9,7 +9,11 @@ class NginxConfig
clean_urls: false,
https_only: false,
worker_connections: 512,
resolver: "8.8.8.8"
resolver: "8.8.8.8",
logging: {
"access" => true,
"error" => "error"
}
}
def initialize(json_file)
......@@ -52,6 +56,9 @@ class NginxConfig
json["error_page"] ||= nil
json["debug"] ||= ENV['STATIC_DEBUG']
logging = json["logging"] || {}
json["logging"] = DEFAULT[:logging].merge(logging)
nameservers = []
if File.exist?("/etc/resolv.conf")
File.open("/etc/resolv.conf", "r").each do |line|
......
......@@ -17,12 +17,17 @@ http {
server_tokens off;
access_log logs/access.log;
<% if logging.fetch('access') %>
access_log logs/access.log;
<% else %>
access_log off;
<% end %>
<% if debug %>
error_log stderr debug;
rewrite_log on;
<% else %>
error_log stderr;
error_log stderr <%= logging.fetch('error') %>;
<% end %>
include mime.types;
......
{
"logging": {
"access": false
}
}
{
"logging": {
"error": "warn"
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment