Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Merge branch 'next' into oauth

🏔️ Peak2972a29ccc0d
diff --cc database/seeders/OauthSettingSeeder.php
index f219aecc04,df7619fec5..e5fa8282ee
--- a/database/seeders/OauthSettingSeeder.php
+++ b/database/seeders/OauthSettingSeeder.php
@@@ -12,51 -13,23 +13,24 @@@ class OauthSettingSeeder extends Seede
*/
public function run(): void
{
- $providers = collect([
- 'azure',
- 'bitbucket',
- 'github',
- 'gitlab',
- 'google',
- 'authentik',
- 'infomaniak',
- ]);
+ try {
+ $providers = collect([
+ 'azure',
+ 'bitbucket',
+ 'github',
+ 'gitlab',
+ 'google',
+ 'authentik',
- ]);
++ 'infomaniak',
++ ])
- $isOauthSeeded = OauthSetting::count() > 0;
+ $isOauthSeeded = OauthSetting::count() > 0;
- // We changed how providers are defined in the database, so we authentik does not exists, we need to recreate all of the auth providers
- // Before authentik was a provider, providers started with 0 id
+ // We changed how providers are defined in the database, so we authentik does not exists, we need to recreate all of the auth providers
+ // Before authentik was a provider, providers started with 0 id
- $isOauthAuthentik = OauthSetting::where('provider', 'authentik')->exists();
- if ($isOauthSeeded) {
- if (! $isOauthAuthentik) {
- $allProviders = OauthSetting::all();
- $notFoundProviders = $providers->diff($allProviders->pluck('provider'));
-
- $allProviders->each(function ($provider) {
- $provider->delete();
- });
- $allProviders->each(function ($provider) use ($providers) {
- $providerName = $provider->provider;
-
- $foundProvider = $providers->first(function ($provider) use ($providerName) {
- return $provider === $providerName;
- });
-
- if ($foundProvider) {
- $newProvder = new OauthSetting;
- $newProvder = $provider;
- unset($newProvder->id);
- $newProvder->save();
- }
- });
-
- foreach ($notFoundProviders as $provider) {
- OauthSetting::create([
- 'provider' => $provider,
- ]);
- }
- } else {
+ $isOauthAuthentik = OauthSetting::where('provider', 'authentik')->exists();
+ if (! $isOauthSeeded || $isOauthAuthentik) {
foreach ($providers as $provider) {
OauthSetting::updateOrCreate([
'provider' => $provider,