mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-04 04:56:52 +00:00
Make aio_community_containers an attribute
Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
parent
228440f2a8
commit
6c04cd055f
5 changed files with 9 additions and 25 deletions
|
|
@ -138,7 +138,7 @@ $app->get('/containers', function (Request $request, Response $response, array $
|
|||
'is_docker_socket_proxy_enabled' => $configurationManager->isDockerSocketProxyEnabled,
|
||||
'is_whiteboard_enabled' => $configurationManager->isWhiteboardEnabled,
|
||||
'community_containers' => $configurationManager->listAvailableCommunityContainers(),
|
||||
'community_containers_enabled' => $configurationManager->GetEnabledCommunityContainers(),
|
||||
'community_containers_enabled' => $configurationManager->aio_community_containers,
|
||||
'bypass_container_update' => $bypass_container_update,
|
||||
]);
|
||||
})->setName('profile');
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ readonly class ContainerDefinitionFetcher {
|
|||
$data = json_decode((string)file_get_contents(DataConst::GetContainersDefinitionPath()), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
||||
$additionalContainerNames = [];
|
||||
foreach ($this->configurationManager->GetEnabledCommunityContainers() as $communityContainer) {
|
||||
foreach ($this->configurationManager->aio_community_containers as $communityContainer) {
|
||||
if ($communityContainer !== '') {
|
||||
$path = DataConst::GetCommunityContainersDirectory() . '/' . $communityContainer . '/' . $communityContainer . '.json';
|
||||
$additionalData = json_decode((string)file_get_contents($path), true, 512, JSON_THROW_ON_ERROR);
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ readonly class ConfigurationController {
|
|||
$enabledCC[] = $item;
|
||||
}
|
||||
}
|
||||
$this->configurationManager->SetEnabledCommunityContainers($enabledCC);
|
||||
$this->configurationManager->aio_community_containers = $enabledCC;
|
||||
}
|
||||
|
||||
if (isset($request->getParsedBody()['delete_collabora_dictionaries'])) {
|
||||
|
|
|
|||
|
|
@ -160,6 +160,11 @@ class ConfigurationManager
|
|||
}
|
||||
}
|
||||
|
||||
public array $aio_community_containers {
|
||||
get => explode(' ', $this->get('aio_community_containers', ''));
|
||||
set { $this->set('aio_community_containers', implode(' ', $value)); }
|
||||
}
|
||||
|
||||
public function GetConfig() : array
|
||||
{
|
||||
if ($this->config === [] && file_exists(DataConst::GetConfigFile()))
|
||||
|
|
@ -931,16 +936,6 @@ class ConfigurationManager
|
|||
}
|
||||
}
|
||||
|
||||
private function GetCommunityContainers() : string {
|
||||
$config = $this->GetConfig();
|
||||
if(!isset($config['aio_community_containers'])) {
|
||||
$config['aio_community_containers'] = '';
|
||||
}
|
||||
|
||||
return $config['aio_community_containers'];
|
||||
}
|
||||
|
||||
|
||||
public function listAvailableCommunityContainers() : array {
|
||||
$cc = [];
|
||||
$dir = scandir(DataConst::GetCommunityContainersDirectory());
|
||||
|
|
@ -976,17 +971,6 @@ class ConfigurationManager
|
|||
return $cc;
|
||||
}
|
||||
|
||||
/** @return list<string> */
|
||||
public function GetEnabledCommunityContainers(): array {
|
||||
return explode(' ', $this->GetCommunityContainers());
|
||||
}
|
||||
|
||||
public function SetEnabledCommunityContainers(array $enabledCommunityContainers) : void {
|
||||
$config = $this->GetConfig();
|
||||
$config['aio_community_containers'] = implode(' ', $enabledCommunityContainers);
|
||||
$this->WriteConfig($config);
|
||||
}
|
||||
|
||||
private function GetEnabledDriDevice() : string {
|
||||
$envVariableName = 'NEXTCLOUD_ENABLE_DRI_DEVICE';
|
||||
$configName = 'nextcloud_enable_dri_device';
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ readonly class DockerActionManager {
|
|||
// Allow to get local ip-address of database container which allows to talk to it even in host mode (the container that requires this needs to be started first then)
|
||||
'AIO_DATABASE_HOST' => gethostbyname('nextcloud-aio-database'),
|
||||
// Allow to get local ip-address of caddy container and add it to trusted proxies automatically
|
||||
'CADDY_IP_ADDRESS' => in_array('caddy', $this->configurationManager->GetEnabledCommunityContainers(), true) ? gethostbyname('nextcloud-aio-caddy') : '',
|
||||
'CADDY_IP_ADDRESS' => in_array('caddy', $this->configurationManager->aio_community_containers, true) ? gethostbyname('nextcloud-aio-caddy') : '',
|
||||
'WHITEBOARD_ENABLED' => $this->configurationManager->isWhiteboardEnabled ? 'yes' : '',
|
||||
default => $this->configurationManager->GetRegisteredSecret($placeholder),
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue