Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F10813576
DockerHubServiceProvider.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
DockerHubServiceProvider.php
View Options
<?php
namespace
Nasqueron\Notifications\Providers
;
use
Illuminate\Contracts\Foundation\Application
;
use
Illuminate\Support\ServiceProvider
;
use
GuzzleHttp\Client
;
use
Keruald\DockerHub\Build\TriggerBuildFactory
;
class
DockerHubServiceProvider
extends
ServiceProvider
{
/**
* Bootstraps the application services.
*
* @return void
*/
public
function
boot
()
{
}
/**
* Gets the tokens to trigger build for the Docker Hub images.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return array
*/
public
static
function
getTokens
(
Application
$app
)
{
$file
=
$app
->
make
(
'config'
)->
get
(
'services.dockerhub.tokens'
);
$fs
=
$app
->
make
(
'filesystem'
)->
disk
(
'local'
);
if
(
$fs
->
exists
(
$file
))
{
$content
=
$fs
->
get
(
$file
);
return
json_decode
(
$content
,
true
);
}
return
[];
}
/**
* Registers the application services.
*
* @return void
*/
public
function
register
()
{
$this
->
app
->
singleton
(
'dockerhub'
,
function
(
Application
$app
)
{
$tokens
=
DockerHubServiceProvider
::
getTokens
(
$app
);
return
new
TriggerBuildFactory
(
new
Client
,
$tokens
);
});
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jul 29, 13:56 (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2764424
Default Alt Text
DockerHubServiceProvider.php (1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment