Skip to content

GitLab

  • Menu
    • Projects Groups Snippets
      Help
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • S ServiceCore
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • bingo
  • ServiceCore
  • Merge requests
  • !292

Merged
Created 10 months ago by Никита Вереин@NevireMaintainer

Develop

  • Overview 0
  • Commits 2
  • Pipelines 2
  • Changes 2
  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
Compare
  • master (base)

and
  • latest version
    f4cfc43b
    2 commits, 10 months ago

2 files
+ 43
- 94

    Preferences

    File browser
    Compare changes
src/Infrastru‎cture/Service‎
Log‎ger‎
BaseLog‎ger.php‎ +1 -1
Configuratio‎nService.php‎ +42 -93
src/Infrastructure/Service/Logger/BaseLogger.php
+ 1
- 1
  • View file @ f4cfc43b

  • Edit in single-file editor

  • Edit in Web IDE


Show all unchanged lines Show 20 lines
string $type = 'monolog',
$stream = 'php://stdout',
$serviceName = null,
string $project,
string $project = '',
$traceDepth = 0
): BaseLogger {
try {
Show 20 lines Show all unchanged lines
src/Infrastructure/Service/ConfigurationService.php
+ 42
- 93
  • View file @ f4cfc43b

  • Edit in single-file editor

  • Edit in Web IDE


Show all unchanged lines Show 20 lines
class ConfigurationService
{
private const NAME_VARIABLES_WITH_PREFIX = [
private const NAME_VARIABLES = [
"app" => [
"project" => "PROJECT",
"filesStorage" => "FILES_STORAGE",
"websocketPort" => "WEBSOKET_PORT",
"internalApiUrl" => "INTERNAL_API_URL",
],
"redis" => [
"host" => "REDIS_HOST",
"port" => "REDIS_PORT",
"scheme" => "REDIS_SCHEME",
"password" => "REDIS_PASSWORD",
],
"kafka" => [
"brokers" => "KAFKA_BROKERS",
"authEnabled" => "KAFKA_AUTH_ENABLED",
"user" => "KAFKA_USER",
"password" => "KAFKA_PASSWORD",
"securityProtocol" => "KAFKA_SECURITY_PROTOCOL",
"saslMechanism" => "KAFKA_SASL_MECHANISM",
],
"mongo" => [
"disabled" => "MONGO_DISABLED",
"host" => "MONGO_HOSTS",
"user" => "MONGO_USER",
"password" => "MONGO_PASSWORD",
"db" => "MONGO_DB",
"uriOpts" => "MONGO_URI_OPTS",
],
"airflow" => [
"user" => "AIRFLOW_USER",
"password" => "AIRFLOW_PASSWORD",
"apiUrl" => "AIRFLOW_API_URL",
],
"logger" => [
"type" => "LOG_TYPE",
"level" => "LOG_LEVEL",
"resource" => "LOG_RESOURCE",
"traceDepth" => "LOG_TRACE_DEPTH",
],
"db" => [
"driver" => "DB_DRIVER",
Show 20 lines Show all unchanged lines Show 20 lines
"dbname" => "DB_NAME",
],
"keycloak" => [
"enabled" => "KEYCLOAK_ENABLED",
"apiUrl" => "KEYCLOAK_API_URL",
"realm" => "KEYCLOAK_REALM",
"apiAdapter" => "KEYCLOAK_API_ADAPTER",
Show 20 lines Show all unchanged lines Show 20 lines
"auth" => "SMTP_AUTH",
],
"s3" => [
"storageAdapter" => "STORAGE_ADAPTER",
"endpoint" => "S3_ENDPOINT",
"bucket" => "S3_BUCKET",
"key" => "S3_KEY",
Show 20 lines Show all unchanged lines Show 20 lines
],
];
private const NAME_VARIABLES_WITHOUT_PREFIX = [
"app" => [
"websocketPort" => "WEBSOKET_PORT",
"internalApiUrl" => "INTERNAL_API_URL",
],
"redis" => [
"host" => "REDIS_HOST",
"port" => "REDIS_PORT",
"scheme" => "REDIS_SCHEME",
"password" => "REDIS_PASSWORD",
],
"kafka" => [
"brokers" => "KAFKA_BROKERS",
"authEnabled" => "KAFKA_AUTH_ENABLED",
"user" => "KAFKA_USER",
"password" => "KAFKA_PASSWORD",
"securityProtocol" => "KAFKA_SECURITY_PROTOCOL",
"saslMechanism" => "KAFKA_SASL_MECHANISM",
"keystoreLocation" => "KAFKA_KEYSTORE_LOCATION",
"keystorePassword" => "KAFKA_KEYSTORE_PASSWORD",
],
"mongo" => [
"disabled" => "MONGO_DISABLED",
"host" => "MONGO_HOSTS",
"user" => "MONGO_USER",
"password" => "MONGO_PASSWORD",
"db" => "MONGO_DB",
"uriOpts" => "MONGO_URI_OPTS",
],
"airflow" => [
"user" => "AIRFLOW_USER",
"password" => "AIRFLOW_PASSWORD",
"apiUrl" => "AIRFLOW_API_URL",
],
"logger" => [
"type" => "LOG_TYPE",
"level" => "LOG_LEVEL",
"resource" => "LOG_RESOURCE",
"traceDepth" => "LOG_TRACE_DEPTH",
],
"keycloak" => [
"enabled" => "KEYCLOAK_ENABLED",
],
"s3" => [
"storageAdapter" => "STORAGE_ADAPTER",
],
];
/**
* @param string|null $domain
* @return array
Show 20 lines Show all unchanged lines Show 20 lines
{
$variables = [];
foreach (self::NAME_VARIABLES_WITH_PREFIX as $key => $value) {
if(gettype($value) != "array") {
foreach (self::NAME_VARIABLES as $name => $variablesEnv) {
foreach ($variablesEnv as $nameEnv => $value) {
$valueEnv = self::getEnvironment($prefix, $value);
if ($valueEnv === false && $prefix != null) {
if ($valueEnv === false) {
$valueEnv = self::getEnvironment(null, $value);
}
$variables[$key] = (string) $valueEnv;
continue;
}
if (self::getPartitionVariables($variables, $key, $value, $prefix) === false) {
self::getPartitionVariables($variables, $key, $value);
}
}
foreach (self::NAME_VARIABLES_WITHOUT_PREFIX as $key => $value) {
if(gettype($value) != "array") {
$variables[$key] = (string) self::getEnvironment(null, $value);
continue;
$variables[$name][$nameEnv] = (string) $valueEnv;
}
self::getPartitionVariables($variables, $key, $value);
}
return $variables;
Show 20 lines Show all unchanged lines Show 20 lines
return null;
}
/**
* @param array $variables
* @param string $partition
* @param array $data
* @param string|null $prefix
* @return boolean
*/
private static function getPartitionVariables(
array &$variables,
string $partition,
array $data,
?string $prefix = null
): bool {
foreach ($data as $name => $value) {
$valueEnv = self::getEnvironment($prefix, $value);
if ($valueEnv === false && $prefix !== null) {
return false;
}
$variables[$partition][$name] = (string) $valueEnv;
}
return true;
}
/**
* @param string|null $prefix
* @param string $name
Show 20 lines Show all unchanged lines
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Milestone
No milestone
None
None
Time tracking
No estimate or time spent
0
Labels
None
Assign labels
  • No matching results
  • Manage project labels
Lock merge request
Unlocked
1
1 participant
user avatar
Reference: Bingo/ServiceCore!292
Source branch: develop

    0 pending comments

Menu

Projects Groups Snippets
Help