mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Added default ports
This commit is contained in:
@@ -129,12 +129,12 @@ $cli
|
||||
->setParam('vars', $input)
|
||||
;
|
||||
|
||||
if(!file_put_contents($path.'/docker-compose.yml.xx', $templateForCompose->render(false))) {
|
||||
if(!file_put_contents($path.'/docker-compose.yml', $templateForCompose->render(false))) {
|
||||
Console::error('Failed to save Docker Compose file');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(!file_put_contents($path.'/.env.xx', $templateForEnv->render(false))) {
|
||||
if(!file_put_contents($path.'/.env', $templateForEnv->render(false))) {
|
||||
Console::error('Failed to save environment variables file');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,19 @@ class Service
|
||||
public function __construct(array $service)
|
||||
{
|
||||
$this->service = $service;
|
||||
$this->service['environment'] = isset($this->service['environment']) ? new Env(implode("\n", $this->service['environment'])) : new Env('');
|
||||
|
||||
$ports = (isset($this->service['ports']) && is_array($this->service['ports'])) ? $this->service['ports'] : [];
|
||||
$this->service['ports'] = [];
|
||||
|
||||
array_walk($ports, function(&$value, &$key) {
|
||||
$split = explode(':', $value);
|
||||
$this->service['ports'][
|
||||
(isset($split[0])) ? $split[0] : ''
|
||||
] = (isset($split[1])) ? $split[1] : '';
|
||||
});
|
||||
|
||||
$this->service['environment'] = (isset($this->service['environment']) && is_array($this->service['environment'])) ? $this->service['environment'] : [];
|
||||
$this->service['environment'] = new Env(implode("\n", $this->service['environment']));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,10 +58,18 @@ class Service
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return Env
|
||||
*/
|
||||
public function getEnvironment(): Env
|
||||
{
|
||||
return $this->service['environment'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getPorts(): array
|
||||
{
|
||||
return $this->service['ports'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ services:
|
||||
- --accesslog=true
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
- 2080:80
|
||||
- 2443:443
|
||||
- 8080:8080
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
@@ -41,6 +41,7 @@ class ComposeTest extends TestCase
|
||||
$this->assertEquals('appwrite', $this->object->getService('appwrite')->getContainerName());
|
||||
$this->assertEquals('', $this->object->getService('appwrite')->getImageVersion());
|
||||
$this->assertEquals('2.2', $this->object->getService('traefik')->getImageVersion());
|
||||
$this->assertEquals(['2080' => '80', '2443' => '443', '8080' => '8080'], $this->object->getService('traefik')->getPorts());
|
||||
}
|
||||
|
||||
public function testNetworks()
|
||||
|
||||
Reference in New Issue
Block a user