Skip to content

Commit

Permalink
Merge pull request #13 from cgauge/extenssion
Browse files Browse the repository at this point in the history
change extenssion url to aws provided
  • Loading branch information
fantazista authored Jan 15, 2025
2 parents c7fe42f + c78bffb commit 865dcd1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/PasswordResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ public function __construct(

public function resolve(string $secret, bool $refresh)
{
$refresh = (int) $refresh;

try {
$result = $this->client->post("http://localhost:8015/cache?name=$secret&refresh=$refresh");
$response = $this->client->withHeader('X-Aws-Parameters-Secrets-Token', $_SERVER['AWS_SESSION_TOKEN'])
->get("http://localhost:2773/secretsmanager/get?secretId=$secret");

$body = (string) $response->getBody();
$result = json_decode($body, true);

if (isset($result['SecretString'])) {
$result = json_decode($result['SecretString'], true);
}
} catch (Throwable $e) {
$this->logger->error('Failed to retrieve password from cache server. ' . $e);

Expand Down

0 comments on commit 865dcd1

Please sign in to comment.