Skip to content

Commit 65bca83

Browse files
committed
fix: patch up app name issue
1 parent b62aec6 commit 65bca83

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/DeployCommand.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected function handle(): int
5151
protected function setupFlyDeployment()
5252
{
5353
$appDir = getcwd();
54-
$appName = strtolower(basename($appDir));
54+
$appName = $this->namify(basename($appDir), 'fly');
5555

5656
if (!\Leaf\FS\File::exists("$appDir/fly.toml")) {
5757
$this->writeln('<info>Writing fly deploy files...</info>');
@@ -64,8 +64,9 @@ protected function setupFlyDeployment()
6464
)
6565
) {
6666
$this->writeln('<info>Deployment files setup!</info>');
67-
$appName = $this->getEnvValue('APP_NAME', "$appDir/.env");
67+
6868
$appRegion = $this->getEnvValue('APP_PROD_REGION', "$appDir/.env");
69+
$appName = $this->namify($this->getEnvValue('APP_NAME', "$appDir/.env"), 'fly');
6970

7071
\Leaf\FS\File::create(
7172
"$appDir/storage/deployments.yml",
@@ -150,6 +151,17 @@ protected function getEnvValue($key, $envPath = __DIR__ . '/.env')
150151
return null;
151152
}
152153

154+
protected function namify($name, $provider)
155+
{
156+
switch (strtolower($provider)) {
157+
case 'fly':
158+
case 'fly.io':
159+
return strtolower(str_replace(['_', ' '], '-', $name));
160+
default:
161+
return strtolower($name);
162+
}
163+
}
164+
153165
protected function isMVCApp()
154166
{
155167
$directory = getcwd();

0 commit comments

Comments
 (0)