Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Bindanのススメ
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
wtnabe
August 16, 2025
Programming
0
39
Bindanのススメ
"バックエンドを切り替えつつ設定を集約して書きたい" というタイトルのLTの資料です。
Kanazawa.rb meetup #156 at ビブリオバウム での発表です。
wtnabe
August 16, 2025
Tweet
Share
More Decks by wtnabe
See All by wtnabe
Rubyでもモノリポしたい - 調査、おわわり編 -
wtnabe
0
26
Ruby de Railway Oriented Programming
wtnabe
0
58
そのオブジェクト、何を保証してくれますか? - GuideRailのススメ -
wtnabe
0
52
Effective Jekyll
wtnabe
0
80
5 min Jekyll/Liquid Plugin cooking
wtnabe
0
45
Ruby de Wasm
wtnabe
0
75
Cloud Native Buildpacksって結局どうなの?
wtnabe
0
61
Decoupled System with Turbo Frame
wtnabe
1
150
join-kanazawarb-or-7years-passed-since-it-was-borned
wtnabe
0
820
Other Decks in Programming
See All in Programming
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
250
Apache Iceberg V3 and migration to V3
tomtanaka
0
150
SourceGeneratorのススメ
htkym
0
190
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
200
CSC307 Lecture 09
javiergs
PRO
1
830
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
690
Grafana:建立系統全知視角的捷徑
blueswen
0
320
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
130
CSC307 Lecture 03
javiergs
PRO
1
490
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
240
2026年 エンジニアリング自己学習法
yumechi
0
130
Fragmented Architectures
denyspoltorak
0
150
Featured
See All Featured
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
230
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
72
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
220
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Technical Leadership for Architectural Decision Making
baasie
1
240
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
130
Deep Space Network (abreviated)
tonyrice
0
45
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
320
Prompt Engineering for Job Search
mfonobong
0
160
The SEO Collaboration Effect
kristinabergwall1
0
350
sira's awesome portfolio website redesign presentation
elsirapls
0
140
AI: The stuff that nobody shows you
jnunemaker
PRO
2
240
Transcript
バックエンドを切り替えつつ 設定を集約して書きたい - Bindan のススメ - @wtnabe Kanazawa.rb meetup #156
at ビブリオバウム 2025-08-16 (Sat)
クラウド環境の設定って環境変数に 置くんじゃないんですか?
ENV["FOO"]
実は環境によって都合が悪い
eg) Google App Engine 環境変数の設定方法が設定ファイルのハードコーディング それがイヤならCloud Build で設定ファイルを組み立てる? Cloud Build
の中で扱っている値はログにダダ漏れ
Google 「環境変数に秘密情報置くな」
分かるけど
じゃあsecret から取ってくる? require "google/cloud/secret_manager" secret = Google::Cloud::SecretManaer.new ...
なんかめんどくさい
やっぱこんな感じで書きたい App.configure do |config| config.database.dsn = "sqlite:memory" config.adapter = :grpc
config.pool = 5 config.uploader.bucket = 'production' end この右辺でシュッとsecret 取り出したい
作ったよ https://github.com/wtnabe/bindan
目指した書き味 Bindan.configure(providers: providers) do |c, pr| c.database_host = pr.env["DATABASE_HOST"] ||
"localhost" c.api_key = pr.storage["api_key"] c.feature_flags = pr.firestore["feature_flags_document"] end
もう少し詳しく configure から container と provider が渡ってくる provider が []
メソッドを提供してくれるのでそこで値を取得する pr.env が envvar provider の正体
provider は自分で追加できる Bindan.configure(providers: { env: Bindan::Provider::Envvar.new }) do |container, providers|
今のところ標準で Cloud Storage Cloud Firestore のprovider を提供
NotImplemented SecretManager 対応 configure を複数回に分けて書く
おまけ - 命名について - 名前は最近よくやってる生成AI との議論で 今回はゲルマン祖語で bind みたいな意味 ラテン語だと
vinculum さすがに分かりにくいので ラテン語以降の近い年代、近い地域の言語に置き換え