Skip to content
5 changes: 4 additions & 1 deletion contrib/endpoints/src/api_manager/context/service_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ class ServiceContext {

bool IsRulesCheckEnabled() const {
return RequireAuth() && service().apis_size() > 0 &&
!config_->GetFirebaseServer().empty();
(!config_->GetFirebaseServer().empty() ||

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this logic inside config::GetFirebaseServer() function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the intention is to separate the logic of server config and service config.

liminw@, what do you think?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Wayne that the logic should be in config::GetFirebaseServer(). This function should be a wrapper, and determine whether the server is set from server config or service config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline with limin, the code is updated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i actually agree with Wayne's comment. Both the service and server config are in config.cc. Moving this logic there makes sense.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack

(service().has_experimental() &&
service().experimental().has_authorization() &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should move this also to GetFirebaseServer. Also, the GetFirebaseServer method should be returning the service config's provide is the server config value is empty. That part is missing. Is this code tested?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little strange. The code was updated before this comment, https://screenshot.googleplex.com/uSnOfw2BUfe, not sure why you still saw old version.

service().experimental().authorization().has_provider()));
}

auth::Certs &certs() { return certs_; }
Expand Down