Finalize types for parsing v3 format
This commit is contained in:
parent
88cddabb51
commit
6d2e47c244
11 changed files with 141 additions and 70 deletions
|
@ -1,5 +1,6 @@
|
|||
|
||||
require "yaml"
|
||||
require "./deployment_settings"
|
||||
|
||||
class RunDeploymentConfig
|
||||
YAML.mapping(
|
||||
|
|
17
src/config/deployment_settings.cr
Normal file
17
src/config/deployment_settings.cr
Normal file
|
@ -0,0 +1,17 @@
|
|||
|
||||
require "yaml"
|
||||
|
||||
class TransferDeploymentConfigSettings
|
||||
YAML.mapping(
|
||||
src: String,
|
||||
dest: String,
|
||||
filters: Array(String)?
|
||||
)
|
||||
end
|
||||
|
||||
class RunDeploymentConfigSettings
|
||||
YAML.mapping(
|
||||
src: String,
|
||||
dest: String,
|
||||
)
|
||||
end
|
|
@ -1,9 +1,28 @@
|
|||
|
||||
require "yaml"
|
||||
require "./endpoint_settings"
|
||||
|
||||
|
||||
class DokkuMariadbEndpointConfig
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
host: String,
|
||||
dokku_mariadb: DokkuMariadbEndpointConfigSettings
|
||||
)
|
||||
end
|
||||
|
||||
class DokkuAppEndpointConfig
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
host: String,
|
||||
dokku_app: DokkuAppEndpointConfigSettings
|
||||
)
|
||||
end
|
||||
|
||||
class ScriptEndpointConfig
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
host: String,
|
||||
script: ScriptEndpointConfigSettings
|
||||
)
|
||||
end
|
||||
|
@ -11,6 +30,7 @@ end
|
|||
class MysqlDumpEndpointConfig
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
host: String,
|
||||
mysql_dump: MysqlDumpEndpointConfigSettings
|
||||
)
|
||||
end
|
||||
|
@ -18,6 +38,7 @@ end
|
|||
class DockerImageEndpointConfig
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
host: String,
|
||||
docker_image: DockerImageEndpointConfigSettings
|
||||
)
|
||||
end
|
||||
|
@ -25,5 +46,7 @@ end
|
|||
alias EndpointConfig =
|
||||
DockerImageEndpointConfig |
|
||||
MysqlDumpEndpointConfig |
|
||||
ScriptEndpointConfig
|
||||
ScriptEndpointConfig |
|
||||
DokkuAppEndpointConfig |
|
||||
DokkuMariadbEndpointConfig
|
||||
|
||||
|
|
37
src/config/endpoint_settings.cr
Normal file
37
src/config/endpoint_settings.cr
Normal file
|
@ -0,0 +1,37 @@
|
|||
|
||||
require "yaml"
|
||||
|
||||
class DokkuMariadbEndpointConfigSettings
|
||||
YAML.mapping(
|
||||
name: String
|
||||
)
|
||||
end
|
||||
|
||||
class DokkuAppEndpointConfigSettings
|
||||
YAML.mapping(
|
||||
name: String
|
||||
)
|
||||
end
|
||||
|
||||
class DockerImageEndpointConfigSettings
|
||||
YAML.mapping(
|
||||
tag: {
|
||||
type: String,
|
||||
nilable: false,
|
||||
default: "latest"
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
class MysqlDumpEndpointConfigSettings
|
||||
YAML.mapping(
|
||||
path: String
|
||||
)
|
||||
end
|
||||
|
||||
class ScriptEndpointConfigSettings
|
||||
YAML.mapping(
|
||||
path: String
|
||||
)
|
||||
end
|
||||
|
22
src/config/filter.cr
Normal file
22
src/config/filter.cr
Normal file
|
@ -0,0 +1,22 @@
|
|||
|
||||
require "yaml"
|
||||
require "./filter_settings"
|
||||
|
||||
|
||||
class DualFilterConfig
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
dual: DualFilterConfigSettings
|
||||
)
|
||||
end
|
||||
|
||||
class MonoFilterConfig
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
cmd: String
|
||||
)
|
||||
end
|
||||
|
||||
alias FilterConfig =
|
||||
MonoFilterConfig |
|
||||
DualFilterConfig
|
9
src/config/filter_settings.cr
Normal file
9
src/config/filter_settings.cr
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
require "yaml"
|
||||
|
||||
class DualFilterConfigSettings
|
||||
YAML.mapping(
|
||||
cmd_in: String,
|
||||
cmd_out: String,
|
||||
)
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
require "yaml"
|
||||
require "./host_settings"
|
||||
|
||||
class LocalHostConfig
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
localhost: Hash(String, YAML::Any)
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
class SshHostConfig
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
ssh: SshHostConfigSettings
|
||||
)
|
||||
end
|
||||
|
||||
alias HostConfig =
|
||||
LocalHostConfig |
|
||||
SshHostConfig
|
9
src/config/host_settings.cr
Normal file
9
src/config/host_settings.cr
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
require "yaml"
|
||||
|
||||
class SshHostConfigSettings
|
||||
YAML.mapping(
|
||||
user: String,
|
||||
host: String
|
||||
)
|
||||
end
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
|
||||
require "yaml"
|
||||
|
||||
class DokkuRemoteConfigSettings
|
||||
YAML.mapping(
|
||||
user: String,
|
||||
host: String
|
||||
)
|
||||
end
|
||||
|
||||
class DokkuRemoteConfig
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
dokku: DokkuRemoteConfigSettings
|
||||
)
|
||||
end
|
||||
|
||||
alias RemoteConfig =
|
||||
DokkuRemoteConfig
|
|
@ -1,49 +0,0 @@
|
|||
|
||||
require "yaml"
|
||||
|
||||
class ScriptLocalConfigSettings
|
||||
YAML.mapping(
|
||||
path: String
|
||||
)
|
||||
end
|
||||
|
||||
class MysqlDumpLocalConfigSettings
|
||||
YAML.mapping(
|
||||
path: String
|
||||
)
|
||||
end
|
||||
|
||||
class DockerImageLocalConfigSettings
|
||||
YAML.mapping(
|
||||
name: String
|
||||
)
|
||||
end
|
||||
|
||||
class DokkuMariadbDeploymentConfigSettings
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
options: YAML::Any | Nil
|
||||
)
|
||||
end
|
||||
|
||||
class DokkuAppDeploymentConfigSettings
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
options: YAML::Any | Nil
|
||||
)
|
||||
end
|
||||
|
||||
class TransferDeploymentConfigSettings
|
||||
YAML.mapping(
|
||||
from: EndpointConfig,
|
||||
to: EndpointConfig,
|
||||
filters: Array(FilterConfig)?
|
||||
)
|
||||
end
|
||||
|
||||
class RunDeploymentConfigSettings
|
||||
YAML.mapping(
|
||||
from: EndpointConfig,
|
||||
to: EndpointConfig,
|
||||
)
|
||||
end
|
Loading…
Reference in a new issue