@@ -41,7 +41,7 @@ pub struct PostgresqlConnection {
4141
4242 /// Name of a Secret containing the `username` and `password` keys used to authenticate
4343 /// against the PostgreSQL server.
44- pub credentials_secret : String ,
44+ pub credentials_secret_name : String ,
4545
4646 /// Additional map of JDBC connection parameters to append to the connection URL. The given
4747 /// `HashMap<String, String>` will be converted to query parameters in the form of
@@ -66,22 +66,22 @@ impl JdbcDatabaseConnection for PostgresqlConnection {
6666 host,
6767 port,
6868 database,
69- credentials_secret ,
69+ credentials_secret_name ,
7070 parameters,
7171 } = self ;
7272 let ( username_env, password_env) =
73- username_and_password_envs ( unique_database_name, credentials_secret ) ;
73+ username_and_password_envs ( unique_database_name, credentials_secret_name ) ;
7474
75- let connection_uri = format ! (
75+ let connection_url = format ! (
7676 "jdbc:postgresql://{host}:{port}/{database}{parameters}" ,
7777 parameters =
7878 connection_parameters_as_url_query_parameters( parameters) . unwrap_or_default( )
7979 ) ;
80- let connection_uri = connection_uri . parse ( ) . context ( ParseConnectionUrlSnafu ) ?;
80+ let connection_url = connection_url . parse ( ) . context ( ParseConnectionUrlSnafu ) ?;
8181
8282 Ok ( JdbcDatabaseConnectionDetails {
8383 driver : POSTGRES_JDBC_DRIVER_CLASS . to_owned ( ) ,
84- connection_uri ,
84+ connection_url ,
8585 username_env : Some ( username_env) ,
8686 password_env : Some ( password_env) ,
8787 } )
@@ -98,17 +98,17 @@ impl SqlAlchemyDatabaseConnection for PostgresqlConnection {
9898 host,
9999 port,
100100 database,
101- credentials_secret ,
101+ credentials_secret_name ,
102102 parameters,
103103 } = self ;
104104 let ( username_env, password_env) =
105- username_and_password_envs ( unique_database_name, credentials_secret ) ;
105+ username_and_password_envs ( unique_database_name, credentials_secret_name ) ;
106106 let username_env_name = & username_env. name ;
107107 let password_env_name = & password_env. name ;
108108 let parameters =
109109 connection_parameters_as_url_query_parameters ( parameters) . unwrap_or_default ( ) ;
110110
111- let uri_template = match templating_mechanism {
111+ let url_template = match templating_mechanism {
112112 TemplatingMechanism :: ConfigUtils => format ! (
113113 "postgresql+psycopg2://${{env:{username_env_name}}}:${{env:{password_env_name}}}@{host}:{port}/{database}{parameters}" ,
114114 ) ,
@@ -117,10 +117,10 @@ impl SqlAlchemyDatabaseConnection for PostgresqlConnection {
117117 ) ,
118118 } ;
119119 SqlAlchemyDatabaseConnectionDetails {
120- uri_template ,
120+ url_template ,
121121 username_env : Some ( username_env) ,
122122 password_env : Some ( password_env) ,
123- generic_uri_var : None ,
123+ generic_url_var : None ,
124124 }
125125 }
126126}
@@ -135,17 +135,17 @@ impl CeleryDatabaseConnection for PostgresqlConnection {
135135 host,
136136 port,
137137 database,
138- credentials_secret ,
138+ credentials_secret_name ,
139139 parameters,
140140 } = self ;
141141 let ( username_env, password_env) =
142- username_and_password_envs ( unique_database_name, credentials_secret ) ;
142+ username_and_password_envs ( unique_database_name, credentials_secret_name ) ;
143143 let username_env_name = & username_env. name ;
144144 let password_env_name = & password_env. name ;
145145 let parameters =
146146 connection_parameters_as_url_query_parameters ( parameters) . unwrap_or_default ( ) ;
147147
148- let uri_template = match templating_mechanism {
148+ let url_template = match templating_mechanism {
149149 TemplatingMechanism :: ConfigUtils => format ! (
150150 "db+postgresql://${{env:{username_env_name}}}:${{env:{password_env_name}}}@{host}:{port}/{database}{parameters}" ,
151151 ) ,
@@ -154,10 +154,10 @@ impl CeleryDatabaseConnection for PostgresqlConnection {
154154 ) ,
155155 } ;
156156 CeleryDatabaseConnectionDetails {
157- uri_template ,
157+ url_template ,
158158 username_env : Some ( username_env) ,
159159 password_env : Some ( password_env) ,
160- generic_uri_var : None ,
160+ generic_url_var : None ,
161161 }
162162 }
163163}
@@ -174,26 +174,26 @@ mod tests {
174174 "
175175 host: airflow-postgresql
176176 database: airflow
177- credentialsSecret : airflow-postgresql-credentials
177+ credentialsSecretName : airflow-postgresql-credentials
178178 " ,
179179 )
180180 . expect ( "invalid test input" ) ;
181181 let sqlalchemy_connection_details =
182182 postgres_connection. sqlalchemy_connection_details ( UNIQUE_DATABASE_NAME ) ;
183183 assert_eq ! (
184- sqlalchemy_connection_details. uri_template ,
184+ sqlalchemy_connection_details. url_template ,
185185 "postgresql+psycopg2://${env:METADATA_DATABASE_USERNAME}:${env:METADATA_DATABASE_PASSWORD}@airflow-postgresql:5432/airflow"
186186 ) ;
187187 assert ! ( sqlalchemy_connection_details. username_env. is_some( ) ) ;
188188 assert ! ( sqlalchemy_connection_details. password_env. is_some( ) ) ;
189- assert ! ( sqlalchemy_connection_details. generic_uri_var . is_none( ) ) ;
189+ assert ! ( sqlalchemy_connection_details. generic_url_var . is_none( ) ) ;
190190
191191 let jdbc_connection_details = postgres_connection
192192 . jdbc_connection_details ( UNIQUE_DATABASE_NAME )
193193 . expect ( "failed to get JDBC connection details" ) ;
194194 assert_eq ! ( jdbc_connection_details. driver, POSTGRES_JDBC_DRIVER_CLASS ) ;
195195 assert_eq ! (
196- jdbc_connection_details. connection_uri . to_string( ) ,
196+ jdbc_connection_details. connection_url . to_string( ) ,
197197 "jdbc:postgresql://airflow-postgresql:5432/airflow"
198198 ) ;
199199 assert_eq ! (
@@ -208,12 +208,12 @@ mod tests {
208208 let celery_connection_details =
209209 postgres_connection. celery_connection_details ( UNIQUE_DATABASE_NAME ) ;
210210 assert_eq ! (
211- celery_connection_details. uri_template ,
211+ celery_connection_details. url_template ,
212212 "db+postgresql://${env:METADATA_DATABASE_USERNAME}:${env:METADATA_DATABASE_PASSWORD}@airflow-postgresql:5432/airflow"
213213 ) ;
214214 assert ! ( celery_connection_details. username_env. is_some( ) ) ;
215215 assert ! ( celery_connection_details. password_env. is_some( ) ) ;
216- assert ! ( celery_connection_details. generic_uri_var . is_none( ) ) ;
216+ assert ! ( celery_connection_details. generic_url_var . is_none( ) ) ;
217217 }
218218
219219 #[ test]
@@ -223,7 +223,7 @@ mod tests {
223223 host: my-airflow.default.svc.cluster.local
224224 database: my_database
225225 port: 1234
226- credentialsSecret : airflow-postgresql-credentials
226+ credentialsSecretName : airflow-postgresql-credentials
227227 parameters:
228228 createDatabaseIfNotExist: true
229229 foo: bar
@@ -233,15 +233,15 @@ mod tests {
233233 let sqlalchemy_connection_details =
234234 postgres_connection. sqlalchemy_connection_details ( UNIQUE_DATABASE_NAME ) ;
235235 assert_eq ! (
236- sqlalchemy_connection_details. uri_template ,
236+ sqlalchemy_connection_details. url_template ,
237237 "postgresql+psycopg2://${env:METADATA_DATABASE_USERNAME}:${env:METADATA_DATABASE_PASSWORD}@my-airflow.default.svc.cluster.local:1234/my_database?createDatabaseIfNotExist=true&foo=bar"
238238 ) ;
239239
240240 let jdbc_connection_details = postgres_connection
241241 . jdbc_connection_details ( UNIQUE_DATABASE_NAME )
242242 . expect ( "failed to get JDBC connection details" ) ;
243243 assert_eq ! (
244- jdbc_connection_details. connection_uri . to_string( ) ,
244+ jdbc_connection_details. connection_url . to_string( ) ,
245245 "jdbc:postgresql://my-airflow.default.svc.cluster.local:1234/my_database?createDatabaseIfNotExist=true&foo=bar"
246246 ) ;
247247 }
0 commit comments