mirror of
https://github.com/elyby/accounts.git
synced 2024-12-28 08:00:25 +05:30
Make Chrly's domain configurable
This commit is contained in:
parent
163bbe68a2
commit
bd168808b2
@ -13,6 +13,7 @@ JWT_PRIVATE_PEM_LOCATION=
|
||||
JWT_PUBLIC_PEM_LOCATION=
|
||||
|
||||
## External services
|
||||
CHRLY_HOST=skinsystem.ely.by
|
||||
RECAPTCHA_PUBLIC=
|
||||
RECAPTCHA_SECRET=
|
||||
SENTRY_DSN=
|
||||
|
@ -26,7 +26,7 @@ return [
|
||||
};
|
||||
},
|
||||
common\components\SkinsSystemApi::class => function() {
|
||||
return new class extends common\components\SkinsSystemApi {
|
||||
return new class('http://chrly.ely.by') extends common\components\SkinsSystemApi {
|
||||
public function textures(string $username): ?array {
|
||||
return [
|
||||
'SKIN' => [
|
||||
|
@ -10,10 +10,14 @@ use Yii;
|
||||
// TODO: convert to complete Chrly client library
|
||||
class SkinsSystemApi {
|
||||
|
||||
private const BASE_DOMAIN = 'http://skinsystem.ely.by';
|
||||
private string $baseDomain;
|
||||
|
||||
private ?ClientInterface $client = null;
|
||||
|
||||
public function __construct(string $baseDomain) {
|
||||
$this->baseDomain = $baseDomain;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||
@ -69,7 +73,7 @@ class SkinsSystemApi {
|
||||
}
|
||||
|
||||
private function buildUrl(string $url): string {
|
||||
return static::BASE_DOMAIN . $url;
|
||||
return $this->baseDomain . $url;
|
||||
}
|
||||
|
||||
private function getClient(): ClientInterface {
|
||||
|
@ -7,7 +7,7 @@ return [
|
||||
],
|
||||
'components' => [
|
||||
'cache' => [
|
||||
'class' => \yii\caching\FileCache::class,
|
||||
'class' => yii\caching\FileCache::class,
|
||||
],
|
||||
'security' => [
|
||||
// It's allows us to increase tests speed by decreasing password hashing algorithm complexity
|
||||
|
@ -19,7 +19,10 @@ return [
|
||||
'singletons' => [
|
||||
GuzzleHttp\ClientInterface::class => GuzzleHttp\Client::class,
|
||||
Ely\Mojang\Api::class => Ely\Mojang\Api::class,
|
||||
common\components\SkinsSystemApi::class => common\components\SkinsSystemApi::class,
|
||||
common\components\SkinsSystemApi::class => [
|
||||
'class' => common\components\SkinsSystemApi::class,
|
||||
'__construct()' => 'http://' . (getenv('CHRLY_HOST') ?: 'skinsystem.ely.by'),
|
||||
],
|
||||
],
|
||||
],
|
||||
'components' => [
|
||||
|
Loading…
Reference in New Issue
Block a user