Skip to content

Instantly share code, notes, and snippets.

@shihanng
Created June 15, 2018 00:01
Show Gist options
  • Save shihanng/89154237b2cf299e9fbf4d21a599c94b to your computer and use it in GitHub Desktop.
Save shihanng/89154237b2cf299e9fbf4d21a599c94b to your computer and use it in GitHub Desktop.
c3c4ab8bfbb5/svc/servicea/api.go.patch
diff --git svc/servicea/api.go svc/servicea/api.go
index 99370e4..a974b63 100644
--- svc/servicea/api.go
+++ svc/servicea/api.go
@@ -5,6 +5,7 @@ import (
"log"
api "github.com/shihanng/gaegoasample/svc/servicea/gen/api"
+ "google.golang.org/appengine"
)
// api service example implementation.
@@ -20,7 +21,15 @@ func NewAPI(logger *log.Logger) api.Service {
// Show info of the service
func (s *apiSvc) Info(ctx context.Context) (res *api.GaegoasampleInfo, err error) {
- res = &api.GaegoasampleInfo{}
+ appID := appengine.AppID(ctx)
+ moduleName := appengine.ModuleName(ctx)
+ versionID := appengine.VersionID(ctx)
+
+ res = &api.GaegoasampleInfo{
+ ID: &appID,
+ ServiceName: &moduleName,
+ Version: &versionID,
+ }
s.logger.Print("api.info")
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment