Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

環境変数をmain.go以外から参照するのをやめる #482

Open
FujishigeTemma opened this issue Sep 11, 2021 · 2 comments
Open

Comments

@FujishigeTemma
Copy link
Contributor

No description provided.

@FujishigeTemma FujishigeTemma added go and removed go labels Sep 11, 2021
@H1rono
Copy link
Member

H1rono commented Jun 23, 2024

これ、configモジュールを作ってその中で環境変数(または設定ファイル?)を読み込むと良さそう

@H1rono
Copy link
Member

H1rono commented Dec 6, 2024

Jomon/service/webhook.go

Lines 76 to 78 in 31fc9cf

webhookSecret := os.Getenv("WEBHOOK_SECRET")
webhookChannelId := os.Getenv("WEBHOOK_CHANNEL_ID")
webhookId := os.Getenv("WEBHOOK_ID")

var JomonClientID = os.Getenv("TRAQ_CLIENT_ID")

Jomon/main.go

Line 23 in 31fc9cf

strg, err = storage.NewLocalStorage(os.Getenv("UPLOAD_DIR"))

Jomon/main.go

Lines 29 to 34 in 31fc9cf

os.Getenv("OS_CONTAINER"),
os.Getenv("OS_USERNAME"),
os.Getenv("OS_PASSWORD"),
os.Getenv("OS_TENANT_NAME"),
os.Getenv("OS_TENANT_ID"),
os.Getenv("OS_AUTH_URL"),

Jomon/main.go

Line 45 in 31fc9cf

if os.Getenv("IS_DEBUG_MODE") != "" {

Jomon/main.go

Line 67 in 31fc9cf

port := os.Getenv("PORT")

e.Debug = os.Getenv("IS_DEBUG_MODE") != ""

e.Use(session.Middleware(sessions.NewCookieStore([]byte(os.Getenv("SESSION_KEY")))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants