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 Type:: signed integer
No Default:: {blank} 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} No Example:: {blank}
== out.dockerComposeYaml == out.dockerComposeYaml
@ -126,6 +106,26 @@ No Default:: {blank}
Read Only:: {blank} Read Only:: {blank}
No Example:: {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 == services
An attribute set of service configurations. A service specifies how to run an image as a container. An attribute set of service configurations. A service specifies how to run an image as a container.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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