@fleetbase/registry-bridge-engine 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/composer.json
CHANGED
package/extension.json
CHANGED
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
namespace Fleetbase\RegistryBridge\Http\Controllers\Internal\v1;
|
|
4
4
|
|
|
5
5
|
use Fleetbase\Exceptions\FleetbaseRequestValidationException;
|
|
6
|
+
use Fleetbase\Http\Requests\AdminRequest;
|
|
6
7
|
use Fleetbase\Models\Setting;
|
|
7
8
|
use Fleetbase\RegistryBridge\Http\Controllers\RegistryBridgeController;
|
|
8
9
|
use Fleetbase\RegistryBridge\Http\Requests\CreateRegistryExtensionRequest;
|
|
@@ -262,9 +263,11 @@ class RegistryExtensionController extends RegistryBridgeController
|
|
|
262
263
|
* This method fetches the current registry host and token from the configuration
|
|
263
264
|
* settings or environment variables and returns them in a JSON response.
|
|
264
265
|
*
|
|
266
|
+
* @param AdminRequest $request the incoming HTTP request containing the new host and token
|
|
267
|
+
*
|
|
265
268
|
* @return \Illuminate\Http\JsonResponse a JSON response containing the registry host and token
|
|
266
269
|
*/
|
|
267
|
-
public function getConfig()
|
|
270
|
+
public function getConfig(AdminRequest $request)
|
|
268
271
|
{
|
|
269
272
|
$registryHost = config('registry-bridge.registry.host', env('REGISTRY_HOST', 'https://registry.fleetbase.io'));
|
|
270
273
|
$registryToken = config('registry-bridge.registry.token', env('REGISTRY_TOKEN'));
|
|
@@ -282,11 +285,11 @@ class RegistryExtensionController extends RegistryBridgeController
|
|
|
282
285
|
* If no input is provided, it uses the current configuration values or environment variables.
|
|
283
286
|
* The updated configuration is then saved in the settings and returned in a JSON response.
|
|
284
287
|
*
|
|
285
|
-
* @param
|
|
288
|
+
* @param AdminRequest $request the incoming HTTP request containing the new host and token
|
|
286
289
|
*
|
|
287
290
|
* @return \Illuminate\Http\JsonResponse a JSON response containing the updated registry host and token
|
|
288
291
|
*/
|
|
289
|
-
public function saveConfig(
|
|
292
|
+
public function saveConfig(AdminRequest $request)
|
|
290
293
|
{
|
|
291
294
|
$currentRegistryHost = config('registry-bridge.registry.host', env('REGISTRY_HOST', 'https://registry.fleetbase.io'));
|
|
292
295
|
$currentRegistryToken = config('registry-bridge.registry.token', env('REGISTRY_TOKEN'));
|
|
@@ -4,7 +4,6 @@ namespace Fleetbase\RegistryBridge\Providers;
|
|
|
4
4
|
|
|
5
5
|
use Fleetbase\Models\Setting;
|
|
6
6
|
use Fleetbase\Providers\CoreServiceProvider;
|
|
7
|
-
use Fleetbase\RegistryBridge\Support\Utils;
|
|
8
7
|
|
|
9
8
|
if (!class_exists(CoreServiceProvider::class)) {
|
|
10
9
|
throw new \Exception('Registry Bridge cannot be loaded without `fleetbase/core-api` installed!');
|
|
@@ -72,7 +71,6 @@ class RegistryBridgeServiceProvider extends CoreServiceProvider
|
|
|
72
71
|
*/
|
|
73
72
|
public function boot()
|
|
74
73
|
{
|
|
75
|
-
Utils::bootRegistryAuth();
|
|
76
74
|
$this->registerCommands();
|
|
77
75
|
$this->registerMiddleware();
|
|
78
76
|
$this->registerExpansionsFrom(__DIR__ . '/../Expansions');
|
|
@@ -82,6 +80,17 @@ class RegistryBridgeServiceProvider extends CoreServiceProvider
|
|
|
82
80
|
$this->mergeConfigFromSettings();
|
|
83
81
|
}
|
|
84
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Merge configuration settings from the database into the application configuration.
|
|
85
|
+
*
|
|
86
|
+
* This function checks if there is a database connection available. If a connection exists,
|
|
87
|
+
* it retrieves the 'registry-bridge.registry.host' and 'registry-bridge.registry.token' values
|
|
88
|
+
* from the settings table and merges them into the application's configuration. If the settings
|
|
89
|
+
* are not available or the database connection does not exist, the function will return without
|
|
90
|
+
* making any changes.
|
|
91
|
+
*
|
|
92
|
+
* @return void
|
|
93
|
+
*/
|
|
85
94
|
public function mergeConfigFromSettings()
|
|
86
95
|
{
|
|
87
96
|
if (Setting::doesntHaveConnection()) {
|