Zack Williams | e940c7a | 2019-08-21 14:25:39 -0700 | [diff] [blame] | 1 | // Copyright 2015 Google Inc. All rights reserved. |
| 2 | // Use of this source code is governed by the Apache 2.0 |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // +build appengine |
| 6 | |
| 7 | package internal |
| 8 | |
| 9 | import ( |
| 10 | "appengine" |
| 11 | |
| 12 | netcontext "golang.org/x/net/context" |
| 13 | ) |
| 14 | |
| 15 | func init() { |
| 16 | appengineStandard = true |
| 17 | } |
| 18 | |
| 19 | func DefaultVersionHostname(ctx netcontext.Context) string { |
| 20 | c := fromContext(ctx) |
| 21 | if c == nil { |
| 22 | panic(errNotAppEngineContext) |
| 23 | } |
| 24 | return appengine.DefaultVersionHostname(c) |
| 25 | } |
| 26 | |
| 27 | func Datacenter(_ netcontext.Context) string { return appengine.Datacenter() } |
| 28 | func ServerSoftware() string { return appengine.ServerSoftware() } |
| 29 | func InstanceID() string { return appengine.InstanceID() } |
| 30 | func IsDevAppServer() bool { return appengine.IsDevAppServer() } |
| 31 | |
| 32 | func RequestID(ctx netcontext.Context) string { |
| 33 | c := fromContext(ctx) |
| 34 | if c == nil { |
| 35 | panic(errNotAppEngineContext) |
| 36 | } |
| 37 | return appengine.RequestID(c) |
| 38 | } |
| 39 | |
| 40 | func ModuleName(ctx netcontext.Context) string { |
| 41 | c := fromContext(ctx) |
| 42 | if c == nil { |
| 43 | panic(errNotAppEngineContext) |
| 44 | } |
| 45 | return appengine.ModuleName(c) |
| 46 | } |
| 47 | func VersionID(ctx netcontext.Context) string { |
| 48 | c := fromContext(ctx) |
| 49 | if c == nil { |
| 50 | panic(errNotAppEngineContext) |
| 51 | } |
| 52 | return appengine.VersionID(c) |
| 53 | } |
| 54 | |
| 55 | func fullyQualifiedAppID(ctx netcontext.Context) string { |
| 56 | c := fromContext(ctx) |
| 57 | if c == nil { |
| 58 | panic(errNotAppEngineContext) |
| 59 | } |
| 60 | return c.FullyQualifiedAppID() |
| 61 | } |