Код: Выделить всё
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Config;
...
$client = new Client();
$apiKey = "my-api-key";
$response = $client->request('GET', 'my-credential-aws-url', [
'headers' => [
'X-API-Key' => $apiKey
],
]);
$data = json_decode($response->getBody()->getContents());
Config::set('database.connections.mysql.host', $data->DB_HOST);
Config::set('database.connections.mysql.database', $data->DB_DATABASE);
Config::set('database.connections.mysql.username', $data->DB_USERNAME);
Config::set('database.connections.mysql.password', $data->DB_PASSWORD);
Подробнее здесь: https://stackoverflow.com/questions/797 ... ws-service