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.
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2025-10-30 17:32:21 -03:00
parent 17d6cd33be
commit a01c7505cb
3 changed files with 2 additions and 27 deletions

View file

@ -183,31 +183,6 @@ BEGIN
END IF; END IF;
END $$; 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 INSERT INTO tenants (id, name, slug, is_active) VALUES
(gen_random_uuid(), 'Default Tenant', 'default', true) (gen_random_uuid(), 'Default Tenant', 'default', true)
ON CONFLICT (slug) DO NOTHING; ON CONFLICT (slug) DO NOTHING;

View file

@ -166,7 +166,7 @@ impl BootstrapManager {
); );
let database_url = std::env::var("DATABASE_URL").unwrap_or_else(|_| { let database_url = std::env::var("DATABASE_URL").unwrap_or_else(|_| {
let username = 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 = let password =
std::env::var("TABLES_PASSWORD").unwrap_or_else(|_| "postgres".to_string()); std::env::var("TABLES_PASSWORD").unwrap_or_else(|_| "postgres".to_string());
let server = let server =

View file

@ -177,7 +177,7 @@ impl AppConfig {
.and_then(|p| p.parse().ok()) .and_then(|p| p.parse().ok())
.unwrap_or_else(|| get_u32("TABLES_PORT", 5432)), .unwrap_or_else(|| get_u32("TABLES_PORT", 5432)),
database: std::env::var("TABLES_DATABASE") 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 { let database_custom = DatabaseConfig {