Update configuration according to new format
This commit is contained in:
parent
8bd39f96a5
commit
1fab12c472
6 changed files with 90 additions and 76 deletions
|
@ -1,14 +1,13 @@
|
|||
|
||||
require "yaml"
|
||||
require "./config/local"
|
||||
require "./config/remote"
|
||||
require "./config/deployment"
|
||||
require "./config/*.cr"
|
||||
|
||||
class Config
|
||||
YAML.mapping(
|
||||
version: String,
|
||||
locals: Array(LocalConfig),
|
||||
remotes: Array(RemoteConfig),
|
||||
hosts: Array(HostConfig),
|
||||
endpoints: Array(EndpointConfig),
|
||||
filters: Array(FilterConfig),
|
||||
deployments: Array(DeploymentConfig)
|
||||
)
|
||||
end
|
||||
|
|
|
@ -1,37 +1,20 @@
|
|||
|
||||
require "yaml"
|
||||
|
||||
class DokkuMariadbDeploymentConfigSettings
|
||||
class RunDeploymentConfig
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
options: YAML::Any | Nil
|
||||
name: String?,
|
||||
run: RunDeploymentConfigSettings
|
||||
)
|
||||
end
|
||||
|
||||
class DokkuAppDeploymentConfigSettings
|
||||
class TransferDeploymentConfig
|
||||
YAML.mapping(
|
||||
name: String,
|
||||
options: YAML::Any | Nil
|
||||
)
|
||||
end
|
||||
|
||||
class DokkuMariadbDeploymentConfig
|
||||
YAML.mapping(
|
||||
local: String,
|
||||
remote: String,
|
||||
dokku_mariadb: DokkuMariadbDeploymentConfigSettings,
|
||||
)
|
||||
end
|
||||
|
||||
class DokkuAppDeploymentConfig
|
||||
YAML.mapping(
|
||||
local: String,
|
||||
remote: String,
|
||||
dokku_app: DokkuAppDeploymentConfigSettings,
|
||||
name: String?,
|
||||
transfer: TransferDeploymentConfigSettings
|
||||
)
|
||||
end
|
||||
|
||||
alias DeploymentConfig =
|
||||
DokkuMariadbDeploymentConfig |
|
||||
DokkuAppDeploymentConfig
|
||||
|
||||
TransferDeploymentConfig |
|
||||
RunDeploymentConfig
|
||||
|
|
29
src/config/endpoint.cr
Normal file
29
src/config/endpoint.cr
Normal 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
0
src/config/host.cr
Normal 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
49
src/config/settings.cr
Normal 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
|
Loading…
Reference in a new issue