Skip to content

Commit c9637ed

Browse files
[Feature] Add possibility to pass initial admin credentials with env variables (alexjustesen#1924)
Co-authored-by: Alex Justesen <[email protected]>
1 parent 36cde05 commit c9637ed

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

config/app.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,10 @@
1616

1717
'force_https' => env('FORCE_HTTPS', false),
1818

19+
'admin_name' => env('ADMIN_NAME', 'Admin'),
20+
21+
'admin_email' => env('ADMIN_EMAIL', '[email protected]'),
22+
23+
'admin_password' => env('ADMIN_PASSWORD', 'password'),
24+
1925
];

database/migrations/2014_10_12_000000_create_users_table.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ public function up(): void
2626
});
2727

2828
User::create([
29-
'name' => 'Admin',
30-
'email' => '[email protected]',
29+
'name' => config('app.admin_name'),
30+
'email' => config('app.admin_email'),
3131
'email_verified_at' => now(),
32-
'password' => Hash::make('password'),
32+
'password' => Hash::make(config('app.admin_password')),
3333
'role' => UserRole::Admin,
3434
]);
3535
}

0 commit comments

Comments
 (0)