feat: implement adding captcha for sqlx postgres

This commit is contained in:
realaravinth
2022-05-12 19:09:44 +05:30
parent 277d2bb9e5
commit 79ff7b9917
3 changed files with 55 additions and 3 deletions

View File

@@ -34,6 +34,21 @@ async fn everyting_works() {
const CAPTCHA_DESCRIPTION: &str = "postgrescaptchadescription";
const CAPTCHA_DURATION: i32 = 30;
const LEVELS: [Level; 3] = [
Level {
difficulty_factor: 1,
visitor_threshold: 1,
},
Level {
difficulty_factor: 2,
visitor_threshold: 2,
},
Level {
difficulty_factor: 3,
visitor_threshold: 3,
},
];
let url = env::var("POSTGRES_DATABASE_URL").unwrap();
let pool_options = PgPoolOptions::new().max_connections(2);
let connection_options = ConnectionOptions::Fresh(Fresh { pool_options, url });
@@ -52,5 +67,5 @@ async fn everyting_works() {
key: CAPTCHA_SECRET,
description: CAPTCHA_DESCRIPTION,
};
database_works(&db, &p, &c).await;
database_works(&db, &p, &c, &LEVELS).await;
}