Documentation ¶
Overview ¶
cloudrun is Cloud Run 固有のmetadataを扱う https://cloud.google.com/run/docs/reference/container-contract#env-vars
Index ¶
- Constants
- func Configuration() (string, error)
- func InstanceID() (string, error)
- func NumericProjectID() (string, error)
- func OnCloudRun() bool
- func OnCloudRunReal() bool
- func ProjectID() (string, error)
- func Region() (string, error)
- func Revision() (string, error)
- func Service() (string, error)
- func ServiceAccountEmail() (string, error)
- func ServiceAccountID() (string, error)
- func ServiceAccountName() (string, error)
- func ServiceAccountsDefaultToken() (string, error)
Constants ¶
const ConfigurationKey = "K_CONFIGURATION"
ConfigurationKey is Cloud Run Configuration Env Key
const RevisionKey = "K_REVISION"
RevisionKey is Cloud Run Revision Env Key
const ServiceKey = "K_SERVICE"
ServiceKey is Cloud Run Service Env Key
Variables ¶
This section is empty.
Functions ¶
func Configuration ¶
Service is return Cloud Run service revision id The name of the Cloud Run configuration that created the revision. Example gcpboxtest
func InstanceID ¶ added in v1.16.0
InstanceID is Cloud Runが動いているWorkerのIDを返す
GCP上で動いていない場合、 $INSTANCE_ID を返す
func NumericProjectID ¶ added in v1.16.0
NumericProjectID is return Project Number
GCP上で動いていない場合、$NUMERIC_GOOGLE_CLOUD_PROJECT を返す
func OnCloudRunReal ¶
func OnCloudRunReal() bool
OnCloudRunReal is AppがCloudRunで動いてるかどうか 環境変数およびOnGCP()も見てるので、本当にCloud Runで動いてるか
func ProjectID ¶ added in v1.16.0
ProjectID is return ProjectID Example gcpboxtest
GCP上で動いていない場合、$GOOGLE_CLOUD_PROJECT $GCLOUD_PROJECT を返す
func Region ¶ added in v1.16.0
Region is return Cloud Runが動作しているRegionを返す Example asia-northeast1
GCP上で動いていない場合、 $INSTANCE_REGION を返す
func ServiceAccountEmail ¶ added in v1.16.0
ServiceAccountEmail is default service accountのEmailを返す
GCP上で動いていない場合、 $GCLOUD_SERVICE_ACCOUNT を返す
func ServiceAccountID ¶ added in v1.16.0
ServiceAccountID is Return current Service Account ID fmt "projects/$PROJECT_ID/serviceAccounts/$SERVICE_ACCOUNT_EMAIL"
GCP上で動いていない場合、 $GOOGLE_CLOUD_PROJECT $GCLOUD_PROJECT $GCLOUD_SERVICE_ACCOUNT を見て返す
func ServiceAccountName ¶ added in v1.16.0
ServiceAccountName is Return current Service Account Name ServiceAccountEmailの@より前の部分を返す
GCP上で動いていない場合、 $GCLOUD_SERVICE_ACCOUNT を見て返す
func ServiceAccountsDefaultToken ¶ added in v1.16.0
ServiceAccountsDefaultToken is default service accountのAccess Tokenを返す
GCP上で動いていない場合、 $SERVICE_ACCOUNTS_DEFAULT_TOKEN を返す
Types ¶
This section is empty.