Skip to content

Commit

Permalink
Issue #1776: Reduce usage of $ENV{OTOBO_SYNC_WITH_S3}
Browse files Browse the repository at this point in the history
  • Loading branch information
bschmalhofer committed May 17, 2022
1 parent 718078e commit 1aff39c
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions Kernel/System/SysConfig.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package Kernel::System::SysConfig;

use v5.24;
use strict;
use warnings;
use v5.24;
use namespace::autoclean;
use utf8;

Expand Down Expand Up @@ -76,17 +76,17 @@ sub new {

$Self->{ConfigObject} = $Kernel::OM->Get('Kernel::Config');

# get home directory
$Self->{Home} = $Self->{ConfigObject}->Get('Home');
# get home directory and whether the S3 backend is active
$Self->{Home} = $Self->{ConfigObject}->Get('Home');
$Self->{UseS3Backend} = $Kernel::OM->Get('Kernel::Config')->Get('Storage::S3::Active') ? 1 : 0;

# Kernel::Config is loaded because it was loaded by $Kernel::OM above.
$Self->{ConfigDefaultObject} = Kernel::Config->new( Level => 'Default' );
$Self->{ConfigObject} = Kernel::Config->new( Level => 'First' );
$Self->{ConfigClearObject} = Kernel::Config->new( Level => 'Clear' );

# Load base files.
my $BaseDir = $Self->{Home} . '/Kernel/System/SysConfig/Base/';

my $BaseDir = $Self->{Home} . '/Kernel/System/SysConfig/Base/';
my $MainObject = $Kernel::OM->Get('Kernel::System::Main');

FILENAME:
Expand Down Expand Up @@ -3660,12 +3660,11 @@ sub ConfigurationDeploy {
$EffectiveValueStrg = $LastDeployment{EffectiveValueStrg};
}

if ( $ENV{OTOBO_SYNC_WITH_S3} ) {

my $StorageS3Object = Kernel::System::Storage::S3->new();
if ( $Self->{UseS3Backend} ) {

# only write to S3, no extra copy in the file system
my $S3Key = $StorageS3Object->StoreObject(
my $StorageS3Object = Kernel::System::Storage::S3->new();
my $S3Key = $StorageS3Object->StoreObject(
Key => $TargetPath,
Content => $EffectiveValueStrg,
);
Expand Down Expand Up @@ -3780,7 +3779,7 @@ sub ConfigurationDeploySync {

# Write latest deployment to ZZZAAuto.pm
my $PMFileContent = $LastDeployment{EffectiveValueStrg};
if ( $ENV{OTOBO_SYNC_WITH_S3} ) {
if ( $Self->{UseS3Backend} ) {

# only write to S3
my $StorageS3Object = Kernel::System::Storage::S3->new();
Expand Down

0 comments on commit 1aff39c

Please sign in to comment.