@@ -98,30 +98,40 @@ pub async fn configure(
98
98
Some ( WorkloadIdentityAuth ( Secret :: Plain ( value) ) ) => {
99
99
let url = Cow :: Borrowed ( value) ;
100
100
std:: env:: set_var ( "BIG_QUERY_AUTH_URL" , url. as_ref ( ) ) ;
101
- gcp_bigquery_client:: Client :: with_workload_identity ( false ) . await . unwrap ( )
102
- } ,
101
+ gcp_bigquery_client:: Client :: with_workload_identity ( false )
102
+ . await
103
+ . unwrap ( )
104
+ }
103
105
Some ( WorkloadIdentityAuth ( Secret :: FromEnvironment { variable } ) ) => {
104
106
let url: Cow < ' _ , String > = Cow :: Owned ( environment. read ( variable) ?) ;
105
107
std:: env:: set_var ( "BIG_QUERY_AUTH_URL" , url. as_ref ( ) ) ;
106
- gcp_bigquery_client:: Client :: with_workload_identity ( false ) . await . unwrap ( )
107
- } ,
108
- None => {
109
- match & args. connection_settings . service_key {
110
- Some ( ServiceKey ( Secret :: Plain ( value) ) ) => {
111
- let service_key = Cow :: Borrowed ( value) ;
112
- let service_account_key = yup_oauth2:: parse_service_account_key ( service_key. as_str ( ) ) . unwrap ( ) ;
113
- gcp_bigquery_client:: Client :: from_service_account_key ( service_account_key, false ) . await . unwrap ( )
114
- } ,
115
- Some ( ServiceKey ( Secret :: FromEnvironment { variable } ) ) => {
116
- let service_key: Cow < ' _ , String > = Cow :: Owned ( environment. read ( variable) ?) ;
117
- let service_account_key = yup_oauth2:: parse_service_account_key ( service_key. as_str ( ) ) . unwrap ( ) ;
118
- gcp_bigquery_client:: Client :: from_service_account_key ( service_account_key, false ) . await . unwrap ( )
119
- } ,
120
- None => {
121
- return Err ( anyhow:: anyhow!( "Neither Workload Identity Auth URL or Service key is provided" ) ) ;
122
- } ,
123
- }
108
+ gcp_bigquery_client:: Client :: with_workload_identity ( false )
109
+ . await
110
+ . unwrap ( )
124
111
}
112
+ None => match & args. connection_settings . service_key {
113
+ Some ( ServiceKey ( Secret :: Plain ( value) ) ) => {
114
+ let service_key = Cow :: Borrowed ( value) ;
115
+ let service_account_key =
116
+ yup_oauth2:: parse_service_account_key ( service_key. as_str ( ) ) . unwrap ( ) ;
117
+ gcp_bigquery_client:: Client :: from_service_account_key ( service_account_key, false )
118
+ . await
119
+ . unwrap ( )
120
+ }
121
+ Some ( ServiceKey ( Secret :: FromEnvironment { variable } ) ) => {
122
+ let service_key: Cow < ' _ , String > = Cow :: Owned ( environment. read ( variable) ?) ;
123
+ let service_account_key =
124
+ yup_oauth2:: parse_service_account_key ( service_key. as_str ( ) ) . unwrap ( ) ;
125
+ gcp_bigquery_client:: Client :: from_service_account_key ( service_account_key, false )
126
+ . await
127
+ . unwrap ( )
128
+ }
129
+ None => {
130
+ return Err ( anyhow:: anyhow!(
131
+ "Neither Workload Identity Auth URL or Service key is provided"
132
+ ) ) ;
133
+ }
134
+ } ,
125
135
} ;
126
136
// let service_key = match &args.connection_settings.service_key {
127
137
// Some(ServiceKey(Secret::Plain(value))) => Cow::Borrowed(value),
@@ -165,7 +175,7 @@ pub async fn configure(
165
175
166
176
// std::env::set_var("BIG_QUERY_AUTH_URL", workload_identity_auth.as_ref());
167
177
168
- // if
178
+ // if
169
179
170
180
// let bigquery_client_auth = gcp_bigquery_client::Client::with_workload_identity(true).await.unwrap();
171
181
0 commit comments