fly-apps / fly-laravel

Run your Laravel apps on Fly
40 stars 3 forks source link

Fix: using __DIR__ in file paths to get correct paths. Changed how fly.toml file is generated. #16

Closed Johannes-Werbrouck closed 1 year ago

Johannes-Werbrouck commented 1 year ago

Fly.toml used to be generated from fly-template.blade.php, so the attributes bag could be used to fill in the app name and php/node versions; like this: {{ $appName }}. I can see how it's convenient, but I've found it very confusing to use blade views for this. Here's how it's done now: In the templates folder there's a fly.toml file. In there, I've added placeholders for the variables that look like this: $APP_NAME$ . When I get the contents of the file, I can do a string_replace for each of the placeholders. They're defined like this: $placeholderVariables = [ 'APP_NAME'=>$this->appName, 'NODE_VERSION'=>$this->nodeVersion, 'PHP_VERSION'=>$this->phpVersion ];

Here's a comparison for the app name in fly.toml: Before: app = "{{$appName}}" Now: app = "$APP_NAME$"