feat(cryptpad): Refactor installer configuration logic

Refactors the CryptPad installer to improve its configuration handling.

- The `hostname` and `namespace` are now derived from the installer's `name` property by default.
- Implemented name sanitization to remove special characters (`_`, `-`, `.`).
- Added validation to ensure the namespace does not contain invalid characters.
- Updated the factory's `reload` function to persist changes made to the installer object after its initial creation.

This change ensures consistent and predictable behavior, allowing for both default generation and manual override of configuration values.

Co-authored-by: Mahmoud-Emad <mahmmoud.hassanein@gmail.com>
This commit is contained in:
peternashaat
2025-11-04 09:01:53 +00:00
parent e3c8d032f7
commit 683008da8f
3 changed files with 20 additions and 5 deletions

View File

@@ -11,9 +11,10 @@ mut installer := cryptpad.get(
create: true
)!
// cryptpad.delete()!
// 2. Configure the installer (all settings are optional with sensible defaults)
installer.hostname = 'mycryptpad'
installer.namespace = 'cryptpad'
// installer.hostname = 'mycryptpad'
// installer.namespace = 'cryptpad'
// 3. Install CryptPad.
// This will generate the necessary Kubernetes YAML files and apply them to your cluster.