Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117559239
D5616.1774859624.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D5616.1774859624.diff
View Options
diff --git a/src/app/Console/Commands/Data/InitCommand.php b/src/app/Console/Commands/Data/InitCommand.php
--- a/src/app/Console/Commands/Data/InitCommand.php
+++ b/src/app/Console/Commands/Data/InitCommand.php
@@ -22,6 +22,24 @@
*/
protected $description = 'Initialization for some expected db entries. Rerunnable to apply latest config changes.';
+
+ /**
+ * Load the override config and apply it
+ *
+ * Create a config/override.php file with content like this:
+ * return [
+ * 'services.imap.uri' => 'overrideValue1',
+ * 'queue.connections.database.table' => 'overrideValue2',
+ * ];
+ */
+ private function applyOverrideConfig(): void
+ {
+ $overrideConfig = (array) \config('override');
+ foreach (array_keys($overrideConfig) as $key) {
+ \config([$key => $overrideConfig[$key]]);
+ }
+ }
+
/**
* Execute the console command.
*
@@ -29,6 +47,7 @@
*/
public function handle()
{
+ $this->applyOverrideConfig();
$this->createImapAdmin();
$this->createNoreplyUser();
$this->createPassportClients();
@@ -134,5 +153,27 @@
$client->id = \config('auth.synapse.client_id');
$client->save();
}
+
+ // Inject extra passport clients via config/override.php
+ if (!empty(\config('auth.extra_passport_clients'))) {
+ foreach (\config('auth.extra_passport_clients') as $clientConfig) {
+ if (!Passport::client()->where('id', $clientConfig['id'])->exists()) {
+ \Log::info("Creating client ". $clientConfig['id']);
+ $client = Passport::client()->forceFill([
+ 'user_id' => null,
+ 'name' => $clientConfig['name'],
+ 'secret' => $clientConfig['secret'],
+ 'provider' => $clientConfig['provider'],
+ 'redirect' => $clientConfig['redirect'],
+ 'personal_access_client' => $clientConfig['personal_access_client'],
+ 'password_client' => $clientConfig['password_client'],
+ 'revoked' => $clientConfig['revoked'],
+ 'allowed_scopes' => $clientConfig['allowed_scopes'],
+ ]);
+ $client->id = $clientConfig['id'];
+ $client->save();
+ }
+ }
+ }
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 30, 8:33 AM (3 d, 3 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18799665
Default Alt Text
D5616.1774859624.diff (2 KB)
Attached To
Mode
D5616: Support injecting extra passport clients via override.php
Attached
Detach File
Event Timeline