Finalize types for parsing v3 format

This commit is contained in:
Glenn Y. Rolland 2020-04-11 21:36:06 +02:00
parent 88cddabb51
commit 6d2e47c244
11 changed files with 141 additions and 70 deletions

View file

@ -1,5 +1,6 @@
require "yaml" require "yaml"
require "./deployment_settings"
class RunDeploymentConfig class RunDeploymentConfig
YAML.mapping( YAML.mapping(

View 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

View file

@ -1,9 +1,28 @@
require "yaml" 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 class ScriptEndpointConfig
YAML.mapping( YAML.mapping(
name: String, name: String,
host: String,
script: ScriptEndpointConfigSettings script: ScriptEndpointConfigSettings
) )
end end
@ -11,6 +30,7 @@ end
class MysqlDumpEndpointConfig class MysqlDumpEndpointConfig
YAML.mapping( YAML.mapping(
name: String, name: String,
host: String,
mysql_dump: MysqlDumpEndpointConfigSettings mysql_dump: MysqlDumpEndpointConfigSettings
) )
end end
@ -18,6 +38,7 @@ end
class DockerImageEndpointConfig class DockerImageEndpointConfig
YAML.mapping( YAML.mapping(
name: String, name: String,
host: String,
docker_image: DockerImageEndpointConfigSettings docker_image: DockerImageEndpointConfigSettings
) )
end end
@ -25,5 +46,7 @@ end
alias EndpointConfig = alias EndpointConfig =
DockerImageEndpointConfig | DockerImageEndpointConfig |
MysqlDumpEndpointConfig | MysqlDumpEndpointConfig |
ScriptEndpointConfig ScriptEndpointConfig |
DokkuAppEndpointConfig |
DokkuMariadbEndpointConfig

View 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
View 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

View file

@ -0,0 +1,9 @@
require "yaml"
class DualFilterConfigSettings
YAML.mapping(
cmd_in: String,
cmd_out: String,
)
end

View file

@ -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

View file

@ -0,0 +1,9 @@
require "yaml"
class SshHostConfigSettings
YAML.mapping(
user: String,
host: String
)
end

View file

@ -1 +0,0 @@

View file

@ -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

View file

@ -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