Skip to content

Commit

Permalink
Whoops.... Fix env replacement...
Browse files Browse the repository at this point in the history
Somehow this got copy pasta'd and yeh.... its not right...
  • Loading branch information
notAreYouScared committed Jun 8, 2024
1 parent dd7a01a commit c5824ff
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Services/Eggs/EggParserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class EggParserService
'server.build.default.port' => 'server.allocations.default.port',
'server.build.env.SERVER_MEMORY' => 'server.build.memory_limit',
'server.build.memory' => 'server.build.memory_limit',
'server.build.env' => 'server.build.environment',
'server.build.env' => 'server.environment',
'server.build.environment' => 'server.environment',
];

/**
Expand Down
40 changes: 40 additions & 0 deletions database/migrations/2024_06_08_020904_refix_egg_variables.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$eggs = DB::table('eggs')->get();

foreach ($eggs as $egg) {
$updatedEnv = str_replace(
'server.build.environment.',
'server.environment.',
$egg->config_files
);

if ($updatedEnv !== $egg->config_files) {
$egg->config_files = $updatedEnv;
echo "Processed ENV update with ID: {$egg->name}\n";
}

DB::table('eggs')
->where('id', $egg->id)
->update(['config_files' => $egg->config_files]);
}
}

/**
* Reverse the migrations.
*/
public function down(): void
{
// We shouldn't revert this...
}
};

0 comments on commit c5824ff

Please sign in to comment.