mehrancodes / laravel-harbor

a cli tool to Quickly create on-demand preview environment for your app on Laravel Forge.
https://www.laravel-harbor.com
MIT License
75 stars 7 forks source link

fix: treat username, database name and domain name the same #46

Closed mgkimsal closed 10 months ago

mgkimsal commented 11 months ago

Keep the site username (if isolated) the same as the filtered/generated domain name, for consistency.

mgkimsal commented 11 months ago

PR branch of

fix/patch-security

currently results in a domain name of 'patch-security' (assuming the environmental subdomain regex is applied), but still assigns a username of fixpatch-security and makes the database name fixpatch-security. For consistency, having all assets (user, subdomain and db name) be the same would help.

mehrancodes commented 11 months ago

Hi @mgkimsal 👋 It's been a long time, happy to see you again.

I would give some code review soon to make sure we would not have any code break for the isolation username and database name. Excited to have this merged soon!!

mehrancodes commented 10 months ago

Supposing our branch name is feature/325-update-welcome-page, It makes the subdomain like 325-update-welcome-page.DOMAIN.COM, And it uses a standardized name (update_welcome_page) that is valid for the isolation username, Database Name, and Database Username.

Because the isolation username does not accept digits at the beginning, we remove the early digits from the standardized name. On another side, we have to replace the dashes with underscores for the database name and database username, which aims to cover all scenarios.

@mgkimsal FYI