Skip to content

Commit

Permalink
Service remotePath property added
Browse files Browse the repository at this point in the history
  • Loading branch information
Ph3nol committed Oct 31, 2017
1 parent 5f50fd9 commit c291572
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Domain/Project/Model/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,17 @@ public function updateServicesIdentifiers(): void
*/
private function getDockerSynchedServiceVolume(ServiceInterface $service): ?array
{
if (null === $service->getPath()) {
return null;
}

if (null === $remotePath = $service->getRemotePath()) {
$remotePath = '/apps/'.($service->getHost() ? : $service->getIdentifier());
}

return [
'local' => sprintf('%s-%s-sync', $this->getIdentifier(), $service->getIdentifier()),
'remote' => '/apps/'.($service->getHost() ? : $service->getIdentifier()),
'remote' => $remotePath,
'type' => 'nocopy',
];
}
Expand All @@ -330,9 +338,13 @@ private function getClassicServiceVolume(ServiceInterface $service): ?array
return null;
}

if (null === $remotePath = $service->getRemotePath()) {
$remotePath = '/apps/'.($service->getHost() ? : $service->getIdentifier());
}

return [
'local' => $path,
'remote' => '/apps/'.($service->getHost() ? : $service->getIdentifier()),
'remote' => $remotePath,
'type' => 'cached',
];
}
Expand Down
25 changes: 25 additions & 0 deletions src/Domain/Service/Model/AbstractService.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ abstract class AbstractService implements ServiceInterface
*/
private $path;

/**
* @var string
*/
private $remotePath;

/**
* @var array
*/
Expand Down Expand Up @@ -180,6 +185,26 @@ public function getPath(): ?string
return $this->path;
}

/**
* @param string $remotePath
*
* @return ServiceInterface
*/
public function setRemotePath(string $remotePath): ServiceInterface
{
$this->remotePath = $remotePath;

return $this;
}

/**
* @return string
*/
public function getRemotePath(): ?string
{
return $this->remotePath;
}

/**
* @param string $host
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public function toModel(ProjectInterface $project, array $data): ServiceInterfac
if ($data['path'] ?? null) {
$service->setPath($data['path']);
}
if ($data['remote_path'] ?? null) {
$service->setRemotePath($data['remote_path']);
}
if ($data['docker_sync'] ?? null) {
$service->withDockerSync();
}
Expand Down

0 comments on commit c291572

Please sign in to comment.