feat(auth): add tenant seed data and bootstrap logic
- seed.rs: creates 21 permissions, admin+viewer roles, admin user with Argon2 password - AuthConfig added to server config with default password Admin@2026 - Server startup: auto-creates default tenant and seeds auth data if not exists - Idempotent: checks for existing tenant before seeding
This commit is contained in:
@@ -6,6 +6,7 @@ pub struct AppConfig {
|
||||
pub database: DatabaseConfig,
|
||||
pub redis: RedisConfig,
|
||||
pub jwt: JwtConfig,
|
||||
pub auth: AuthConfig,
|
||||
pub log: LogConfig,
|
||||
}
|
||||
|
||||
@@ -39,6 +40,11 @@ pub struct LogConfig {
|
||||
pub level: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct AuthConfig {
|
||||
pub super_admin_password: String,
|
||||
}
|
||||
|
||||
impl AppConfig {
|
||||
pub fn load() -> anyhow::Result<Self> {
|
||||
let config = config::Config::builder()
|
||||
|
||||
Reference in New Issue
Block a user