From ac984c06f514a5e6f81739fe724194f24e6ca546 Mon Sep 17 00:00:00 2001 From: andrewshan Date: Fri, 2 Sep 2022 10:48:33 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=BF=AE=E6=94=B9=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=98=E9=87=8F=E7=9A=84=E8=B5=8B=E5=80=BC=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ngx_http_polaris_limit_module.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/nginx_polaris_limit_module/ngx_http_polaris_limit_module.cpp b/source/nginx_polaris_limit_module/ngx_http_polaris_limit_module.cpp index 0f80136..3ebbcb6 100644 --- a/source/nginx_polaris_limit_module/ngx_http_polaris_limit_module.cpp +++ b/source/nginx_polaris_limit_module/ngx_http_polaris_limit_module.cpp @@ -212,9 +212,9 @@ static char *ngx_http_polaris_limit_conf_set(ngx_conf_t *cf, ngx_command_t *cmd, } if (!has_namespace) { - char *namespace_env_value = getenv(ENV_NAMESPACE.c_str()); + const char *namespace_env_value = getenv(ENV_NAMESPACE.c_str()); if (NULL != namespace_env_value) { - plcf->service_namespace = std::string(namespace_env_value); + plcf->service_namespace.assign(namespace_env_value); } else { plcf->service_namespace = DEFAULT_NAMESPACE; } @@ -222,9 +222,9 @@ static char *ngx_http_polaris_limit_conf_set(ngx_conf_t *cf, ngx_command_t *cmd, } if (!has_service) { - char *service_env_value = getenv(ENV_SERVICE.c_str()); + const char *service_env_value = getenv(ENV_SERVICE.c_str()); if (NULL != service_env_value) { - plcf->service_name = std::string(service_env_value); + plcf->service_name.assign(service_env_value); } else { plcf->service_name = DEFAULT_SERVICE; } @@ -232,7 +232,7 @@ static char *ngx_http_polaris_limit_conf_set(ngx_conf_t *cf, ngx_command_t *cmd, } if (!has_enable) { - char *enable_env_value = getenv(ENV_RATELIMIT_ENABLE.c_str()); + const char *enable_env_value = getenv(ENV_RATELIMIT_ENABLE.c_str()); if (NULL != enable_env_value) { std::string enable_str = std::string(enable_env_value); plcf->enable = string2bool(enable_str) ? 1 : 0;