Move name -> project.name

This commit is contained in:
Robert Hensing 2020-10-11 12:02:58 +02:00
parent 92c389fab5
commit b959ab492d
7 changed files with 33 additions and 29 deletions

View file

@ -68,26 +68,6 @@ intended for production-like deployment scenarios.
Type:: signed integer
No Default:: {blank}
No Example:: {blank}
== name
Name of the project.
See link:https://docs.docker.com/compose/reference/envvars/#compose_project_name[COMPOSE_PROJECT_NAME]
[discrete]
=== details
Type:: null or string
Default::
+
----
null
----
No Example:: {blank}
== out.dockerComposeYaml
@ -126,6 +106,26 @@ No Default:: {blank}
Read Only:: {blank}
No Example:: {blank}
== project.name
Name of the project.
See link:https://docs.docker.com/compose/reference/envvars/#compose_project_name[COMPOSE_PROJECT_NAME]
[discrete]
=== details
Type:: null or string
Default::
+
----
null
----
No Example:: {blank}
== services
An attribute set of service configurations. A service specifies how to run an image as a container.

View file

@ -1,6 +1,6 @@
{ pkgs, ... }:
{
config.name = "webapp";
config.project.name = "webapp";
config.services = {
webserver = {

View file

@ -10,7 +10,7 @@ import Arion.Aeson
import Arion.Images (loadImages)
import qualified Arion.DockerCompose as DockerCompose
import Arion.Services (getDefaultExec)
import Arion.ExtendedInfo (loadExtendedInfoFromPath, ExtendedInfo(images, name))
import Arion.ExtendedInfo (loadExtendedInfoFromPath, ExtendedInfo(images, projectName))
import Options.Applicative
import Control.Monad.Fail
@ -155,7 +155,7 @@ callDC cmd dopts shouldLoadImages path = do
when shouldLoadImages $ loadImages (images extendedInfo)
let firstOpts =
do
n <- toList (name extendedInfo)
n <- toList (projectName extendedInfo)
["--project-name", n]
DockerCompose.run DockerCompose.Args
{ files = [path]

View file

@ -23,7 +23,7 @@ data Image = Image
} deriving (Eq, Show, Generic, Aeson.ToJSON, Aeson.FromJSON)
data ExtendedInfo = ExtendedInfo {
name :: Maybe Text,
projectName :: Maybe Text,
images :: [Image]
} deriving (Eq, Show)
@ -32,6 +32,6 @@ loadExtendedInfoFromPath fp = do
v <- decodeFile fp
pure ExtendedInfo {
-- TODO: use aeson derived instance?
name = v ^? key "x-arion" . key "name" . _String,
projectName = v ^? key "x-arion" . key "project" . key "name" . _String,
images = (v :: Aeson.Value) ^.. key "x-arion" . key "images" . _Array . traverse . _JSON
}

View file

@ -37,7 +37,9 @@
"imageTag": "<HASH>"
}
],
"name": null,
"project": {
"name": null
},
"serviceInfo": {
"webserver": {
"defaultExec": [

View file

@ -30,7 +30,9 @@
"imageTag": "xr4ljmz3qfcwlq9rl4mr4qdrzw93rl70"
}
],
"name": null,
"project": {
"name": null
},
"serviceInfo": {
"webserver": {
"defaultExec": [

View file

@ -8,7 +8,7 @@ let
in
{
options = {
name = mkOption {
project.name = mkOption {
description = ''
Name of the project.
@ -19,6 +19,6 @@ in
};
};
config = {
docker-compose.extended.name = config.name;
docker-compose.extended.project.name = config.project.name;
};
}