Use UTF-8 encoding for nginx plugin

This commit is contained in:
cumul
2020-02-24 01:25:16 +09:00
committed by cumul0529
parent 84b57fac93
commit d6ef34a03e
@@ -1,5 +1,6 @@
"""NginxParser is a member object of the NginxConfigurator class."""
import copy
import codecs
import functools
import glob
import logging
@@ -205,7 +206,7 @@ class NginxParser(object):
if item in self.parsed and not override:
continue
try:
with open(item) as _file:
with codecs.open(item, "r", "utf-8") as _file:
parsed = nginxparser.load(_file)
self.parsed[item] = parsed
trees.append(parsed)
@@ -414,7 +415,7 @@ class NginxParser(object):
def _parse_ssl_options(ssl_options):
if ssl_options is not None:
try:
with open(ssl_options) as _file:
with codecs.open(ssl_options, "r", "utf-8") as _file:
return nginxparser.load(_file)
except IOError:
logger.warning("Missing NGINX TLS options file: %s", ssl_options)