Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [WIP] fix and improve .env configs population and operations for setup step #3856

Closed

Conversation

KirylHatalski
Copy link
Contributor

fix: [WIP] fix and improve .env configs population and operations for setup step

@codecov-commenter
Copy link

Codecov Report

Merging #3856 (e0667be) into develop (3ce1ff4) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

@@              Coverage Diff              @@
##             develop    #3856      +/-   ##
=============================================
- Coverage      27.58%   27.55%   -0.03%     
- Complexity     10972    10980       +8     
=============================================
  Files            922      922              
  Lines          33900    33933      +33     
=============================================
  Hits            9351     9351              
- Misses         24549    24582      +33     
Impacted Files Coverage Δ
install/class.Setup.php 0.00% <0.00%> (ø)
...sses/configurationMarkers/ConfigurationMarkers.php 49.42% <0.00%> (-17.77%) ⬇️

@github-actions
Copy link

Version

Target Version 53.4.2
Last version 53.4.1

There are 0 BREAKING CHANGE, 0 feature, 8 fixes

@@ -203,6 +209,12 @@ public function __invoke($params)
'install_path' => $options['root_path'] . 'tao/install/',
];

$markers = new ConfigurationMarkers(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably don't need this code block here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -38,12 +38,12 @@

require_once($root . 'vendor/autoload.php');

new DotEnvReader();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this change? Its intentional?

@@ -124,7 +124,16 @@ public function writeConstants(array $constants)
} elseif (is_numeric($val)) {
$content = preg_replace('/(\'' . $name . '\')(.*?)$/ms', '$1, ' . $val . ');', $content);
}
elseif (method_exists($val, '__toPhpSprintfCode')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check how the __toPhpCode() method is being used? Do we need to have you method called manually?

if(strlen(preg_replace(self::MARKER_PATTERN, '', $item)) > 0) {
$item = $this->serializableFactory->create($indexes, $item, true);
} else {
$item = $this->serializableFactory->create($indexes, $item);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(strlen(preg_replace(self::MARKER_PATTERN, '', $item)) > 0) {
  $item = $this->serializableFactory->create($indexes, $item, true);
} else {
  $item = $this->serializableFactory->create($indexes, $item);
}

to

$flag = strlen(preg_replace(self::MARKER_PATTERN, '', $item)) > 0;
$item = $this->serializableFactory->create($indexes, $item, $flag);

*/
public function __toPhpCode(): string
{
return vsprintf(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can call __toPhpSprintfCode() here ? No worries about calling it in install/utils/class.ConfigWriter.php wdyt?

/**
* Replace configuration variable with environment variable
*/
class SerializableSecretDtoExtended
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To remove code duplication we could create new abstract class with common code from SerializableSecretDtoExtended and SerializableSecretDto and do SerializableSecretDtoExtended extends SerializableSecretDtoAbstract

/**
* Replace configuration variable with environment variable
*/
class SerializableSecretDtoExtended
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe name SerializableSprintfSecretDto will be better? More explanatory for sure :)

*/
public function __toString(): string
{
return vsprintf(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also just call __toPhpSprintfCode() here.

@@ -142,6 +142,7 @@ public function __invoke(ContainerConfigurator $configurator): void

$services
->set(ResourceTransferProxy::class, ResourceTransferProxy::class)
->share(false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What it does? Its related to your code? Looks like something which need to be double checked

@KirylHatalski KirylHatalski deleted the fix/AUT-3129/make-placeholders-replaceable branch March 21, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants