Merge "Add config params"
This commit is contained in:
@@ -142,7 +142,33 @@ def get_proxy_endpoints() -> Dict[str, ProxyEndpoint]:
|
||||
@click.option(
|
||||
"--log-dir",
|
||||
"log_dir",
|
||||
help=("skyline log file address."),
|
||||
help="""Nginx log directory.
|
||||
|
||||
When specifying the log directory and access/error log files
|
||||
paths, the following scenarios are possible:
|
||||
|
||||
1) --log-dir is specified (or not, then the default is used)
|
||||
and --(access|error)-log-file is NOT specified. In this case the default
|
||||
values for the file path is used
|
||||
|
||||
2) --log-dir is speficied (or not ...) and --(access|error)-log-file is also
|
||||
specified as a relative path. In this case the resulting path will be
|
||||
{log_dir}/{*_log_file}
|
||||
|
||||
3) --log-dir is specified (or not ...) and --(access|error)-log-file is also
|
||||
specified as an absolute path. In this case the --log-dir is ignored and the
|
||||
resulting path will be {*_log_file}
|
||||
""",
|
||||
)
|
||||
@click.option(
|
||||
"--access-log-file",
|
||||
"access_log_file",
|
||||
help=("Nginx access log file."),
|
||||
)
|
||||
@click.option(
|
||||
"--error-log-file",
|
||||
"error_log_file",
|
||||
help=("Nginx error log file."),
|
||||
)
|
||||
def main(
|
||||
output_file_path: str,
|
||||
@@ -150,6 +176,8 @@ def main(
|
||||
ssl_keyfile: str,
|
||||
listen_address: str,
|
||||
log_dir: str,
|
||||
access_log_file: str,
|
||||
error_log_file: str,
|
||||
) -> None:
|
||||
try:
|
||||
configure("skyline")
|
||||
@@ -177,8 +205,16 @@ def main(
|
||||
context.update(ssl_keyfile=ssl_keyfile)
|
||||
if listen_address:
|
||||
context.update(listen_address=listen_address)
|
||||
if log_dir:
|
||||
context.update(log_dir=log_dir)
|
||||
_access_log_file = Path(log_dir or CONF.default.log_dir).joinpath(
|
||||
access_log_file or CONF.default.access_log_file
|
||||
)
|
||||
_error_log_file = Path(log_dir or CONF.default.log_dir).joinpath(
|
||||
error_log_file or CONF.default.error_log_file
|
||||
)
|
||||
context.update(
|
||||
access_log_file=_access_log_file,
|
||||
error_log_file=_error_log_file,
|
||||
)
|
||||
result = template.render(**context)
|
||||
|
||||
if output_file_path:
|
||||
|
||||
@@ -31,7 +31,7 @@ log_dir = Opt(
|
||||
name="log_dir",
|
||||
description="Log directory",
|
||||
schema=StrictStr,
|
||||
default="./log",
|
||||
default="/var/log/skyline",
|
||||
)
|
||||
|
||||
log_file = Opt(
|
||||
@@ -41,6 +41,20 @@ log_file = Opt(
|
||||
default="skyline.log",
|
||||
)
|
||||
|
||||
access_log_file = Opt(
|
||||
name="access_log_file",
|
||||
description="Nginx access log file",
|
||||
schema=StrictStr,
|
||||
default="skyline-nginx-access.log",
|
||||
)
|
||||
|
||||
error_log_file = Opt(
|
||||
name="error_log_file",
|
||||
description="Nginx error log file",
|
||||
schema=StrictStr,
|
||||
default="skyline-nginx-error.log",
|
||||
)
|
||||
|
||||
secret_key = Opt(
|
||||
name="secret_key",
|
||||
description="Secret key",
|
||||
@@ -145,6 +159,8 @@ ALL_OPTS = (
|
||||
debug,
|
||||
log_dir,
|
||||
log_file,
|
||||
access_log_file,
|
||||
error_log_file,
|
||||
secret_key,
|
||||
access_token_expire,
|
||||
access_token_renew,
|
||||
|
||||
@@ -44,8 +44,8 @@ http {
|
||||
'"$upstream_response_time" "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
access_log {{ log_dir | default('/var/log/skyline') }}/skyline-nginx-access.log main;
|
||||
error_log {{ log_dir | default('/var/log/skyline') }}/skyline-nginx-error.log;
|
||||
access_log {{ access_log_file }} main;
|
||||
error_log {{ error_log_file }};
|
||||
|
||||
##
|
||||
# Gzip Settings
|
||||
|
||||
Reference in New Issue
Block a user