From f8e2c3f94b16ea90cf2a7eb3287fbe04ca1dd4d7 Mon Sep 17 00:00:00 2001 From: "Rodrigo Rodriguez (Pragmatismo)" Date: Thu, 30 Oct 2025 17:32:21 -0300 Subject: [PATCH] feat(config): remove default server config and update database credentials Removed the default server configuration section from migrations as these values should now be managed through environment variables. Updated default database username from 'postgres' to 'gbuser' in bootstrap and changed default database name from 'gbuser' to 'botserver' in config to align with the removed server configuration defaults. --- migrations/6.0.4.sql | 25 ------------------------- src/bootstrap/mod.rs | 2 +- src/config/mod.rs | 2 +- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/migrations/6.0.4.sql b/migrations/6.0.4.sql index 7847d9927..c22b0e7da 100644 --- a/migrations/6.0.4.sql +++ b/migrations/6.0.4.sql @@ -183,31 +183,6 @@ BEGIN END IF; END $$; --- ============================================================================ --- DEFAULT SERVER CONFIGURATION --- Insert default values that replace .env --- ============================================================================ -INSERT INTO server_configuration (id, config_key, config_value, config_type, description) VALUES - (gen_random_uuid()::text, 'SERVER_HOST', '127.0.0.1', 'string', 'Server bind address'), - (gen_random_uuid()::text, 'SERVER_PORT', '8080', 'integer', 'Server port'), - (gen_random_uuid()::text, 'TABLES_SERVER', 'localhost', 'string', 'PostgreSQL server address'), - (gen_random_uuid()::text, 'TABLES_PORT', '5432', 'integer', 'PostgreSQL port'), - (gen_random_uuid()::text, 'TABLES_DATABASE', 'botserver', 'string', 'PostgreSQL database name'), - (gen_random_uuid()::text, 'TABLES_USERNAME', 'botserver', 'string', 'PostgreSQL username'), - (gen_random_uuid()::text, 'DRIVE_SERVER', 'localhost:9000', 'string', 'MinIO server address'), - (gen_random_uuid()::text, 'DRIVE_USE_SSL', 'false', 'boolean', 'Use SSL for drive'), - (gen_random_uuid()::text, 'DRIVE_ORG_PREFIX', 'botserver', 'string', 'Drive organization prefix'), - (gen_random_uuid()::text, 'DRIVE_BUCKET', 'default', 'string', 'Default S3 bucket'), - (gen_random_uuid()::text, 'VECTORDB_URL', 'http://localhost:6333', 'string', 'Qdrant vector database URL'), - (gen_random_uuid()::text, 'CACHE_URL', 'redis://localhost:6379', 'string', 'Redis cache URL'), - (gen_random_uuid()::text, 'STACK_PATH', './botserver-stack', 'string', 'Base path for all components'), - (gen_random_uuid()::text, 'SITES_ROOT', './botserver-stack/sites', 'string', 'Root path for sites') -ON CONFLICT (config_key) DO NOTHING; - --- ============================================================================ --- DEFAULT TENANT --- Create default tenant for single-tenant installations --- ============================================================================ INSERT INTO tenants (id, name, slug, is_active) VALUES (gen_random_uuid(), 'Default Tenant', 'default', true) ON CONFLICT (slug) DO NOTHING; diff --git a/src/bootstrap/mod.rs b/src/bootstrap/mod.rs index c1393cbd0..9e48a403f 100644 --- a/src/bootstrap/mod.rs +++ b/src/bootstrap/mod.rs @@ -166,7 +166,7 @@ impl BootstrapManager { ); let database_url = std::env::var("DATABASE_URL").unwrap_or_else(|_| { let username = - std::env::var("TABLES_USERNAME").unwrap_or_else(|_| "postgres".to_string()); + std::env::var("TABLES_USERNAME").unwrap_or_else(|_| "gbuser".to_string()); let password = std::env::var("TABLES_PASSWORD").unwrap_or_else(|_| "postgres".to_string()); let server = diff --git a/src/config/mod.rs b/src/config/mod.rs index 6938c128b..2724ddbcc 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -177,7 +177,7 @@ impl AppConfig { .and_then(|p| p.parse().ok()) .unwrap_or_else(|| get_u32("TABLES_PORT", 5432)), database: std::env::var("TABLES_DATABASE") - .unwrap_or_else(|_| get_str("TABLES_DATABASE", "gbuser")), + .unwrap_or_else(|_| get_str("TABLES_DATABASE", "botserver")), }; let database_custom = DatabaseConfig {