-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new composer config commands for composer authentication
- Loading branch information
Showing
6 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kiboko\Component\Dockerfile\PHP; | ||
|
||
use Kiboko\Component\Dockerfile\Dockerfile; | ||
|
||
final readonly class ComposerGithubOauthAuthentication implements Dockerfile\LayerInterface, \Stringable | ||
{ | ||
public function __construct( | ||
private string $token, | ||
) { | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return (string) new Dockerfile\Run(sprintf(<<<'RUN' | ||
set -ex \ | ||
&& composer config --auth github-oauth.github.com %s | ||
RUN, $this->token)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kiboko\Component\Dockerfile\PHP; | ||
|
||
use Kiboko\Component\Dockerfile\Dockerfile; | ||
|
||
final readonly class ComposerGitlabOauthAuthentication implements Dockerfile\LayerInterface, \Stringable | ||
{ | ||
public function __construct( | ||
private string $token, | ||
private string $instance = 'gitlab.com', | ||
) { | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return (string) new Dockerfile\Run(sprintf(<<<'RUN' | ||
set -ex \ | ||
&& composer config --auth gitlab-oauth.%s %s | ||
RUN, $this->instance, $this->token)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kiboko\Component\Dockerfile\PHP; | ||
|
||
use Kiboko\Component\Dockerfile\Dockerfile; | ||
|
||
final readonly class ComposerGitlabTokenAuthentication implements Dockerfile\LayerInterface, \Stringable | ||
{ | ||
public function __construct( | ||
private string $token, | ||
private string $instance = 'gitlab.com', | ||
) { | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return (string) new Dockerfile\Run(sprintf(<<<'RUN' | ||
set -ex \ | ||
&& composer config --auth gitlab-token.%s %s | ||
RUN, $this->instance, $this->token)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kiboko\Component\Dockerfile\PHP; | ||
|
||
use Kiboko\Component\Dockerfile\Dockerfile; | ||
|
||
final readonly class ComposerHttpBasicAuthentication implements Dockerfile\LayerInterface, \Stringable | ||
{ | ||
public function __construct( | ||
private string $url, | ||
private string $username, | ||
private string $password, | ||
) { | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return (string) new Dockerfile\Run(sprintf(<<<'RUN' | ||
set -ex \ | ||
&& composer config --auth http-basic.%s %s %s | ||
RUN, $this->url, $this->username, $this->password)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kiboko\Component\Dockerfile\PHP; | ||
|
||
use Kiboko\Component\Dockerfile\Dockerfile; | ||
|
||
final readonly class ComposerHttpBearerAuthentication implements Dockerfile\LayerInterface, \Stringable | ||
{ | ||
public function __construct( | ||
private string $url, | ||
private string $token, | ||
) { | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return (string) new Dockerfile\Run(sprintf(<<<'RUN' | ||
set -ex \ | ||
&& composer config --auth bearer.%s %s | ||
RUN, $this->url, $this->token)); | ||
} | ||
} |