Module HTM::Config::Database ¶
| Defined in | lib/htm/config/database.rb |
Public Instance Methods¶
actual_database_name() ¶
Extract the actual database name from URL or config
- @return [String, nil] the database name
database_config() ¶
Not documented.
database_configured?() ¶
@return[Boolean]
database_host() ¶
@return[String, nil] the database host
database_name() ¶
@return[String, nil] the database name
database_password() ¶
@return[String, nil] the database password
database_port() ¶
@return[Integer, nil] the database port
database_url() ¶
Database convenience methods
database_user() ¶
@return[String, nil] the database user
expected_database_name() ¶
Returns the expected database name based on service.name and environment
- @return [String] expected database name in format "{service_name}_{environment}"
@example
parse_database_url() ¶
Parse database URL into component hash
- @return [Hash, nil] parsed components or nil if no URL
valid_database_name?() ¶
Check if the database name matches the expected convention
- @return [Boolean] true if database name matches expected
validate_database!() ¶
Validate that database is configured for the current environment
- @raise [HTM::ConfigurationError] if database is not configured
- @return [true] if database is configured
validate_database_name!() ¶
Validate that the database name follows the naming convention
Database names must be: {service_name}_{environment}
- @raise [HTM::ConfigurationError] if database name doesn't match expected
- @return [true] if database name is valid
@example Valid configurations
HTM_ENV=test, service.name=htm, database=htm_test # OK
HTM_ENV=production, service.name=payroll, database=payroll_production # OK
@example Invalid configurations (will raise)