-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathServer.php
More file actions
101 lines (86 loc) · 2.13 KB
/
Server.php
File metadata and controls
101 lines (86 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
namespace Hypernode\DeployConfiguration;
/**
* Contains information per deploy server.
*/
class Server
{
public const OPTION_HN_BRANCHER = 'hn_brancher';
public const OPTION_HN_BRANCHER_LABELS = 'hn_brancher_labels';
public const OPTION_HN_BRANCHER_SETTINGS = 'hn_brancher_settings';
public const OPTION_HN_BRANCHER_TIMEOUT = 'hn_brancher_timeout';
public const OPTION_HN_BRANCHER_REACHABILITY_CHECK_COUNT = 'hn_brancher_reachability_check_count';
public const OPTION_HN_BRANCHER_REACHABILITY_CHECK_INTERVAL = 'hn_brancher_reachability_check_interval';
public const OPTION_HN_PARENT_APP = 'hn_parent_app';
/**
* @var string
*/
private $hostname;
/**
* @var string[]
*/
private $roles;
private array $options;
/**
* @var string[]
*/
private $sshOptions = [];
/**
* @param string[] $roles
*/
public function __construct(string $hostname, array $roles = null, array $options = [])
{
$this->hostname = $hostname;
$this->roles = $roles ?: ServerRole::getValues();
$this->options = $options;
}
/**
* @return string
*/
public function getHostname(): string
{
return $this->hostname;
}
public function setHostname(string $hostname): void
{
$this->hostname = $hostname;
}
/**
* @return string[]
*/
public function getRoles(): array
{
return $this->roles;
}
public function getOptions(): array
{
return $this->options;
}
/**
* @return string[]
*/
public function getSshOptions(): array
{
return $this->sshOptions;
}
/**
* @param string $option
* @param mixed $value
* @return void
*/
protected function setOption(string $option, $value)
{
$this->options[$option] = $value;
}
/**
* @param $options
*/
public function setSshOptions(array $options): void
{
$this->sshOptions = $options;
}
public function addSshOption(string $name, string $value): void
{
$this->sshOptions[$name] = $value;
}
}