Cli user
This commit is contained in:
@ -2,8 +2,8 @@
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
return [
|
||||
Psr\Http\Client\ClientInterface::class => function(ContainerInterface $container) {
|
||||
return new GuzzleHttp\Client([
|
||||
Incoviba\Service\Login::class => function(ContainerInterface $container) {
|
||||
$client = new GuzzleHttp\Client([
|
||||
'base_uri' => $container->get('API_URL'),
|
||||
'headers' => [
|
||||
'Authorization' => [
|
||||
@ -11,5 +11,23 @@ return [
|
||||
]
|
||||
]
|
||||
]);
|
||||
return new Incoviba\Service\Login(
|
||||
$client,
|
||||
$container->get(Psr\Log\LoggerInterface::class),
|
||||
implode(DIRECTORY_SEPARATOR, [$container->get('folders')->cache, 'token']),
|
||||
$container->get('API_USERNAME'),
|
||||
$container->get('API_PASSWORD')
|
||||
);
|
||||
},
|
||||
Psr\Http\Client\ClientInterface::class => function(ContainerInterface $container) {
|
||||
$login = $container->get(Incoviba\Service\Login::class);
|
||||
return new GuzzleHttp\Client([
|
||||
'base_uri' => $container->get('API_URL'),
|
||||
'headers' => [
|
||||
'Authorization' => [
|
||||
"Bearer {$login->getKey($container->get('API_KEY'))}"
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
];
|
||||
|
Reference in New Issue
Block a user