feat(web-service): allow custom access token with persisted port and localized start errors
- Persist user-supplied access token and last-used port in app_metadata, falling back to defaults when unset - Atomically guard concurrent starts via compare_exchange with RAII rollback of the running flag - Wrap token and port persistence in a single SeaORM transaction to prevent partial writes - Classify bind errors (port in use, permission denied, address unavailable, invalid address) into stable i18n keys - Localize start-failure messages across all 10 supported languages
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
use chrono::Utc;
|
||||
use sea_orm::sea_query::OnConflict;
|
||||
use sea_orm::DatabaseConnection;
|
||||
use sea_orm::{ConnectionTrait, DatabaseConnection};
|
||||
use sea_orm::{ActiveValue::NotSet, ColumnTrait, EntityTrait, QueryFilter, Set};
|
||||
|
||||
use crate::db::entities::app_metadata;
|
||||
use crate::db::error::DbError;
|
||||
|
||||
pub async fn upsert_value(
|
||||
conn: &DatabaseConnection,
|
||||
pub async fn upsert_value<C: ConnectionTrait>(
|
||||
conn: &C,
|
||||
key: &str,
|
||||
value: &str,
|
||||
) -> Result<(), DbError> {
|
||||
|
||||
Reference in New Issue
Block a user