File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,12 @@ license = "Apache-2.0"
66description = " Plugin to for managing secrets on shuttle"
77keywords = [" shuttle-service" , " secrets" ]
88
9+ [features ]
10+ config = [" config" , " serde" ]
11+
912[dependencies ]
1013async-trait = " 0.1.56"
1114serde_json = " 1"
1215shuttle-service = { path = " ../../service" , version = " 0.40.0" }
16+ config = { version = " 0.14.0" , optional = true }
17+ serde = { workspace = true , optional = true }
Original file line number Diff line number Diff line change @@ -23,3 +23,25 @@ impl ResourceInputBuilder for Secrets {
2323 ) )
2424 }
2525}
26+
27+ #[ cfg( feature = "config" ) ]
28+ impl < ' de > From < shuttle_secrets:: SecretStore > for T
29+ where
30+ T : serde:: Deserialize < ' de > ,
31+ {
32+ fn from ( value : shuttle_secrets:: SecretStore ) -> Self {
33+ let secrets = value. into_iter ( ) . collect :: < HashMap < _ , _ > > ( ) ;
34+
35+ config:: Config :: builder ( )
36+ . add_source (
37+ config:: Environment :: default ( )
38+ . source ( Some ( secrets) )
39+ . try_parsing ( true )
40+ . separator ( "__" ) ,
41+ )
42+ . build ( )
43+ . expect ( "Failed to load app configuration" )
44+ . try_deserialize ( )
45+ . expect ( "Cannot deserialize configuration" )
46+ }
47+ }
You can’t perform that action at this time.
0 commit comments