Skip to content

catechlounge/gcp-auth-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

coming_readerのGCP認証

(参考)GoogleCloudサービス間認証 https://cloud.google.com/sdk/gcloud/reference/auth/print-identity-token

1. 環境変数を設定

/go または /python ディレクトリで作成してください

touch .env

TARGET_URLとAUDIENCEはGCPのCloud RunのURLを設定してください。 パスの指定を間違えないようにしてください

export GOOGLE_APPLICATION_CREDENTIALS="/path/to/gcp-credential.json"
TARGET_URL="GCP_CLOUD_RUN_URL"
AUDIENCE="GCP_CLOUD_RUN_URL"

pythonの場合はrequirements.txtを作成してください requirements.txt

python-dotenv
google-auth
requests

2. 実行

goの場合

go mod tidy
go run main.go

pythonの場合

  1. 仮想環境を作成
python3 -m venv venv
  1. 仮想環境をアクティベート
source venv/bin/activate
  1. 依存関係をインストール
pip3 install -r requirements.txt
  1. 実行
python3 main.py

5.仮想環境を終了

deactivate

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published