@@ -9,6 +9,7 @@ mod to_runtime_configuration;
9
9
mod upgrade_from_v4;
10
10
11
11
use ndc_models:: { CollectionName , TypeName } ;
12
+ use std:: borrow:: Cow ;
12
13
use std:: collections:: { BTreeMap , HashSet } ;
13
14
use std:: path:: Path ;
14
15
pub use to_runtime_configuration:: make_runtime_configuration;
@@ -26,6 +27,7 @@ use metadata::database;
26
27
use crate :: connect:: read_ssl_info;
27
28
use crate :: environment:: Environment ;
28
29
use crate :: error:: { ParseConfigurationError , WriteParsedConfigurationError } ;
30
+ use crate :: { ConnectionUri , Secret } ;
29
31
30
32
const CONFIGURATION_FILENAME : & str = "configuration.json" ;
31
33
const CONFIGURATION_JSONSCHEMA_FILENAME : & str = "schema.json" ;
@@ -136,8 +138,13 @@ pub async fn introspect(
136
138
args : ParsedConfiguration ,
137
139
environment : impl Environment ,
138
140
) -> anyhow:: Result < ParsedConfiguration > {
139
- let connect_options =
140
- crate :: get_connect_options ( & args. get_connection_uri ( ) ?, & read_ssl_info ( environment) ) ?;
141
+ let connection_uri = match & args. connection_settings . connection_uri {
142
+ ConnectionUri ( Secret :: Plain ( value) ) => Cow :: Borrowed ( value) ,
143
+ ConnectionUri ( Secret :: FromEnvironment { variable } ) => {
144
+ Cow :: Owned ( environment. read ( variable) ?)
145
+ }
146
+ } ;
147
+ let connect_options = crate :: get_connect_options ( & connection_uri, & read_ssl_info ( environment) ) ?;
141
148
142
149
let mut connection = PgConnection :: connect_with ( & connect_options)
143
150
. instrument ( info_span ! ( "Connect to database" ) )
0 commit comments