Skip to content

Commit

Permalink
Applied latest changes of ApiManager (#203)
Browse files Browse the repository at this point in the history
* Applied latest changes of ApiManager

* Removed unnecessary codes

* Removed unnecessary codes

* Removed empty lines
  • Loading branch information
mangchiandjjoe authored Jun 22, 2017
1 parent ebc8cad commit 4ec6cb5
Show file tree
Hide file tree
Showing 7 changed files with 422 additions and 17 deletions.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#
# A Bazel (http://bazel.io) workspace for the Google Cloud Endpoints runtime.

ISTIO_PROXY = "d07998ec42b5fe410d7d299ffd4579801ff6c705"
ISTIO_PROXY = "b129798546b499db2966921f4ba4dc53bb56bd5c"
ESP_TOOL = "ff0d6df7f56ca1c2b229aaadd8abe62cb1d508fb"

git_repository(
Expand Down
11 changes: 5 additions & 6 deletions src/nginx/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -573,8 +573,10 @@ ngx_int_t ngx_esp_build_server_config(ngx_conf_t *cf, ngx_esp_loc_conf_t *lc,
// the config file from nginx config will override the ones from
// server_config.
if (lc->endpoints_config.len > 0) {
auto init_service_configs = config.mutable_init_service_configs();
init_service_configs->Clear();
auto service_config_rollout = config.mutable_service_config_rollout();
auto traffic_percentages =
service_config_rollout->mutable_traffic_percentages();
traffic_percentages->clear();

ngx_str_t file_name = lc->endpoints_config;
if (ngx_conf_full_name(cf->cycle, &file_name, 1) != NGX_OK) {
Expand All @@ -585,10 +587,7 @@ ngx_int_t ngx_esp_build_server_config(ngx_conf_t *cf, ngx_esp_loc_conf_t *lc,
return NGX_ERROR;
}

auto service_config = init_service_configs->Add();
service_config->set_service_config_file_full_path(
ngx_str_to_std(file_name));
service_config->set_traffic_percentage(100.0);
(*traffic_percentages)[ngx_str_to_std(file_name)] = 100.0;
}

// Reserialize
Expand Down
8 changes: 8 additions & 0 deletions src/nginx/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,14 @@ ngx_int_t ngx_esp_postconfiguration(ngx_conf_t *cf) {
return NGX_ERROR;
}

// Verify service configs loading status.
if (!lc->esp->LoadServiceRollouts().ok()) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"Failed to load service configuration files");
handle_endpoints_config_error(cf, lc);
return NGX_ERROR;
}

// Verify we have service name.
if (lc->esp->service_name().empty()) {
ngx_conf_log_error(
Expand Down
1 change: 1 addition & 0 deletions src/nginx/t/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ nginx_suite(
"check_with_token.t",
"config_extra_field.t",
"config_missing.t",
"config_rollouts_managed.t",
"cors.t",
"cors_disabled.t",
"fail_wrong_api_key.t",
Expand Down
Loading

0 comments on commit 4ec6cb5

Please sign in to comment.