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
wtnabe
August 16, 2025
Programming
70
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Bindanのススメ
"バックエンドを切り替えつつ設定を集約して書きたい" というタイトルのLTの資料です。
Kanazawa.rb meetup #156 at ビブリオバウム での発表です。
wtnabe
August 16, 2025
More Decks by wtnabe
See All by wtnabe
新しいフロントプロセスとドキュメントフォーマットを考えてみた
wtnabe
0
40
Rubyでもモノリポしたい - 調査、おさわり編 -
wtnabe
0
71
Ruby de Railway Oriented Programming
wtnabe
0
120
そのオブジェクト、何を保証してくれますか? - GuideRailのススメ -
wtnabe
0
80
Effective Jekyll
wtnabe
0
100
5 min Jekyll/Liquid Plugin cooking
wtnabe
0
69
Ruby de Wasm
wtnabe
0
100
Cloud Native Buildpacksって結局どうなの?
wtnabe
0
86
Decoupled System with Turbo Frame
wtnabe
1
180
Other Decks in Programming
See All in Programming
いまどきの Codex で開発する visionOS アプリの開発スタイルについて
karad
0
180
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
420
異なる設計思想のフレームワークを経験して得た学び
amekuhideki
2
1.5k
[DroidKaigi 26] How We Moved from Android Studio to Slack
thisaay
0
180
Flow は今どうなっているか
mizdra
PRO
0
870
이 함수, 실패하면 어떻게 되나요? null부터 Rich Errors까지, Kotlin 에러 처리 15년
haeti2
0
120
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
290
コンパウンドプロダクト開発のためのローカルプロセスマネージャー再発明 #layerxgo
izumin5210
0
620
初めての模倣学習とVLA
natsutan
0
440
一参加者から『中の人』へ 〜全通PHPerがブースに立って学んだ、カンファレンスを100倍楽しむコツ〜
wp_daisuke
0
110
高専キャリア LT 発表内容
crysta1221
6
5.5k
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
41k
Designing Powerful Visuals for Engaging Learning
tmiket
1
530
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
570
Automating Front-end Workflow
addyosmani
1369
210k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
460
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
180
The SEO identity crisis: Don't let AI make you average
varn
0
550
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
4
560
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
How to make the Groovebox
asonas
2
2.4k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
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 さすがに分かりにくいので ラテン語以降の近い年代、近い地域の言語に置き換え