Update configuration according to new format

This commit is contained in:
Glenn Y. Rolland 2020-04-11 00:10:20 +02:00
parent 8bd39f96a5
commit 1fab12c472
6 changed files with 90 additions and 76 deletions

View file

@ -1,14 +1,13 @@
require "yaml" require "yaml"
require "./config/local" require "./config/*.cr"
require "./config/remote"
require "./config/deployment"
class Config class Config
YAML.mapping( YAML.mapping(
version: String, version: String,
locals: Array(LocalConfig), hosts: Array(HostConfig),
remotes: Array(RemoteConfig), endpoints: Array(EndpointConfig),
filters: Array(FilterConfig),
deployments: Array(DeploymentConfig) deployments: Array(DeploymentConfig)
) )
end end

View file

@ -1,37 +1,20 @@
require "yaml" require "yaml"
class DokkuMariadbDeploymentConfigSettings class RunDeploymentConfig
YAML.mapping( YAML.mapping(
name: String, name: String?,
options: YAML::Any | Nil run: RunDeploymentConfigSettings
) )
end end
class DokkuAppDeploymentConfigSettings class TransferDeploymentConfig
YAML.mapping( YAML.mapping(
name: String, name: String?,
options: YAML::Any | Nil transfer: TransferDeploymentConfigSettings
)
end
class DokkuMariadbDeploymentConfig
YAML.mapping(
local: String,
remote: String,
dokku_mariadb: DokkuMariadbDeploymentConfigSettings,
)
end
class DokkuAppDeploymentConfig
YAML.mapping(
local: String,
remote: String,
dokku_app: DokkuAppDeploymentConfigSettings,
) )
end end
alias DeploymentConfig = alias DeploymentConfig =
DokkuMariadbDeploymentConfig | TransferDeploymentConfig |
DokkuAppDeploymentConfig RunDeploymentConfig

29
src/config/endpoint.cr Normal file
View file

@ -0,0 +1,29 @@
require "yaml"
class ScriptEndpointConfig
YAML.mapping(
name: String,
script: ScriptEndpointConfigSettings
)
end
class MysqlDumpEndpointConfig
YAML.mapping(
name: String,
mysql_dump: MysqlDumpEndpointConfigSettings
)
end
class DockerImageEndpointConfig
YAML.mapping(
name: String,
docker_image: DockerImageEndpointConfigSettings
)
end
alias EndpointConfig =
DockerImageEndpointConfig |
MysqlDumpEndpointConfig |
ScriptEndpointConfig

0
src/config/host.cr Normal file
View file

View file

@ -1,47 +1 @@
require "yaml"
class ScriptLocalConfigSettings
YAML.mapping(
path: String
)
end
class MysqlDumpLocalConfigSettings
YAML.mapping(
path: String
)
end
class DockerImageLocalConfigSettings
YAML.mapping(
name: String
)
end
class ScriptLocalConfig
YAML.mapping(
name: String,
script: ScriptLocalConfigSettings
)
end
class MysqlDumpLocalConfig
YAML.mapping(
name: String,
mysql_dump: MysqlDumpLocalConfigSettings
)
end
class DockerImageLocalConfig
YAML.mapping(
name: String,
docker_image: DockerImageLocalConfigSettings
)
end
alias LocalConfig =
DockerImageLocalConfig |
MysqlDumpLocalConfig |
ScriptLocalConfig

49
src/config/settings.cr Normal file
View file

@ -0,0 +1,49 @@
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