1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-21 20:33:00 +00:00

rename CONFDIR -> CONFIGDIR

This commit is contained in:
Jörn-Michael Miehe 2022-01-24 17:39:55 +01:00
parent 29bc413f8e
commit f926409a3f
8 changed files with 13 additions and 12 deletions

View file

@ -112,11 +112,11 @@ networks:
```
#### The `CONFDIR`
#### The `CONFIGDIR`
Sometimes, it's convenient to re-use configuration files across projects.
For this use case, create a directory named `conf` in a project.
Those will all be combined into a directory available as **${CONFDIR}** in your `docker-compose.yml` files.
Those will all be combined into a directory available as **${CONFIGDIR}** in your `docker-compose.yml` files.
#### `kiwi.yml` options

View file

@ -46,10 +46,10 @@ services:
- "8081:8080"
another-web:
# Another webserver just to show off the ${CONFDIR} variable
# Another webserver just to show off the ${CONFIGDIR} variable
image: nginx:stable-alpine
restart: unless-stopped
ports:
- "8082:80"
volumes:
- "${CONFDIR}/html/index.html:/usr/share/nginx/html/index.html:ro"
- "${CONFIGDIR}/html/index.html:/usr/share/nginx/html/index.html:ro"

View file

@ -34,8 +34,9 @@ HEADER_KIWI_CONF_NAME = f"{KIWI_ROOT}/data/etc/kiwi_header.yml"
DEFAULT_KIWI_CONF_NAME = f"{KIWI_ROOT}/data/etc/kiwi_default.yml"
DEFAULT_DOCKER_COMPOSE_NAME = f"{KIWI_ROOT}/data/etc/docker-compose_default.yml"
# special config directory in projects
CONF_DIRECTORY_NAME = 'conf'
# special config directory
CONF_DIRECTORY_NAME = 'config'
# location for auxiliary Dockerfiles
IMAGES_DIRECTORY_NAME = f"{KIWI_ROOT}/data/images"

View file

@ -49,7 +49,7 @@ class Project:
"COMPOSE_PROJECT_NAME": project_name,
"KIWI_HUB_NAME": kiwi_hub_name,
"TARGETROOT": str(target_root_dir),
"CONFDIR": str(conf_dir),
"CONFIGDIR": str(conf_dir),
"TARGETDIR": str(target_dir),
},
}

View file

@ -18,7 +18,7 @@ def main(verbose: int) -> None:
- Manage full instances using just your favorite version control system
- Group services into projects, each with their own docker-compose.yml
- Build service-specific, private docker images from Dockerfiles
- Make use of the local file system by referring to ${TARGETDIR}, ${TARGETROOT} and ${CONFDIR} in compose files
- Make use of the local file system by referring to ${TARGETDIR}, ${TARGETROOT} and ${CONFIGDIR} in compose files
- Create your own instance-global variables for compose files using the kiwi.yml "environment" section
"""

View file

@ -22,7 +22,7 @@ class Service:
content: CommentedMap = attr.ib()
parent: "Project" = attr.ib()
_RE_CONFDIR = re.compile(r"^\s*\$(?:CONFDIR|{CONFDIR})/+(.*)$", flags=re.UNICODE)
_RE_CONFIGDIR = re.compile(r"^\s*\$(?:CONFIGDIR|{CONFIGDIR})/+(.*)$", flags=re.UNICODE)
@property
def configs(self) -> Generator[Path, None, None]:
@ -31,7 +31,7 @@ class Service:
for volume in self.content["volumes"]:
host_part = volume.split(":")[0]
cd_match = Service._RE_CONFDIR.match(host_part)
cd_match = Service._RE_CONFIGDIR.match(host_part)
if cd_match:
yield Path(cd_match.group(1))

View file

@ -51,8 +51,8 @@ class TestDefault:
content=CommentedMap({
"image": "repo/image:tag",
"volumes": [
"${CONFDIR}/some/config:/path/to/some/config",
"$CONFDIR/other/config:/path/to/other/config",
"${CONFIGDIR}/some/config:/path/to/some/config",
"CONFIGDIR/other/config:/path/to/other/config",
]
}),
parent=None,