summaryrefslogtreecommitdiffstats
path: root/src/models
diff options
context:
space:
mode:
Diffstat (limited to 'src/models')
-rw-r--r--src/models/auth.rs2
-rw-r--r--src/models/model.rs6
-rw-r--r--src/models/user.rs6
3 files changed, 7 insertions, 7 deletions
diff --git a/src/models/auth.rs b/src/models/auth.rs
index 36a0175..8a70244 100644
--- a/src/models/auth.rs
+++ b/src/models/auth.rs
@@ -40,7 +40,7 @@ pub struct LoginCredentials {
}
static KEYS: Lazy<Keys> = Lazy::new(|| {
- let secret = std::env::var("JWT_SECRET").expect("JWT_SECRET must be set");
+ let secret = &crate::config::CONFIG.jwt_secret;
Keys::new(secret.as_bytes())
});
diff --git a/src/models/model.rs b/src/models/model.rs
index 5b47f5c..f686192 100644
--- a/src/models/model.rs
+++ b/src/models/model.rs
@@ -1,4 +1,4 @@
-use crate::config::PAGE_LIMIT;
+use crate::config::CONFIG;
use crate::db::get_client;
use crate::errors::AppError;
@@ -163,8 +163,8 @@ impl Model {
GROUP BY models.id, users.id
LIMIT $1 OFFSET $2
"#,
- PAGE_LIMIT,
- PAGE_LIMIT * page
+ CONFIG.page_limit,
+ CONFIG.page_limit * page
)
.fetch_all(pool)
.await?;
diff --git a/src/models/user.rs b/src/models/user.rs
index 22bd130..55abc97 100644
--- a/src/models/user.rs
+++ b/src/models/user.rs
@@ -1,4 +1,4 @@
-use crate::config::PAGE_LIMIT;
+use crate::config::CONFIG;
use crate::db::get_client;
use crate::errors::AppError;
@@ -121,8 +121,8 @@ impl User {
r#"SELECT id, email, username, is_staff FROM users
LIMIT $1 OFFSET $2
"#,
- PAGE_LIMIT,
- PAGE_LIMIT * page
+ CONFIG.page_limit,
+ CONFIG.page_limit * page
)
.fetch_all(pool)
.await?;