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:
parent
29bc413f8e
commit
f926409a3f
8 changed files with 13 additions and 12 deletions
|
@ -112,11 +112,11 @@ networks:
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### The `CONFDIR`
|
#### The `CONFIGDIR`
|
||||||
|
|
||||||
Sometimes, it's convenient to re-use configuration files across projects.
|
Sometimes, it's convenient to re-use configuration files across projects.
|
||||||
For this use case, create a directory named `conf` in a project.
|
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
|
#### `kiwi.yml` options
|
||||||
|
|
|
@ -46,10 +46,10 @@ services:
|
||||||
- "8081:8080"
|
- "8081:8080"
|
||||||
|
|
||||||
another-web:
|
another-web:
|
||||||
# Another webserver just to show off the ${CONFDIR} variable
|
# Another webserver just to show off the ${CONFIGDIR} variable
|
||||||
image: nginx:stable-alpine
|
image: nginx:stable-alpine
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "8082:80"
|
- "8082:80"
|
||||||
volumes:
|
volumes:
|
||||||
- "${CONFDIR}/html/index.html:/usr/share/nginx/html/index.html:ro"
|
- "${CONFIGDIR}/html/index.html:/usr/share/nginx/html/index.html:ro"
|
||||||
|
|
|
@ -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_KIWI_CONF_NAME = f"{KIWI_ROOT}/data/etc/kiwi_default.yml"
|
||||||
DEFAULT_DOCKER_COMPOSE_NAME = f"{KIWI_ROOT}/data/etc/docker-compose_default.yml"
|
DEFAULT_DOCKER_COMPOSE_NAME = f"{KIWI_ROOT}/data/etc/docker-compose_default.yml"
|
||||||
|
|
||||||
# special config directory in projects
|
# special config directory
|
||||||
CONF_DIRECTORY_NAME = 'conf'
|
CONF_DIRECTORY_NAME = 'config'
|
||||||
|
|
||||||
# location for auxiliary Dockerfiles
|
# location for auxiliary Dockerfiles
|
||||||
IMAGES_DIRECTORY_NAME = f"{KIWI_ROOT}/data/images"
|
IMAGES_DIRECTORY_NAME = f"{KIWI_ROOT}/data/images"
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Project:
|
||||||
"COMPOSE_PROJECT_NAME": project_name,
|
"COMPOSE_PROJECT_NAME": project_name,
|
||||||
"KIWI_HUB_NAME": kiwi_hub_name,
|
"KIWI_HUB_NAME": kiwi_hub_name,
|
||||||
"TARGETROOT": str(target_root_dir),
|
"TARGETROOT": str(target_root_dir),
|
||||||
"CONFDIR": str(conf_dir),
|
"CONFIGDIR": str(conf_dir),
|
||||||
"TARGETDIR": str(target_dir),
|
"TARGETDIR": str(target_dir),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ def main(verbose: int) -> None:
|
||||||
- Manage full instances using just your favorite version control system
|
- Manage full instances using just your favorite version control system
|
||||||
- Group services into projects, each with their own docker-compose.yml
|
- Group services into projects, each with their own docker-compose.yml
|
||||||
- Build service-specific, private docker images from Dockerfiles
|
- 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
|
- Create your own instance-global variables for compose files using the kiwi.yml "environment" section
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Service:
|
||||||
content: CommentedMap = attr.ib()
|
content: CommentedMap = attr.ib()
|
||||||
parent: "Project" = 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
|
@property
|
||||||
def configs(self) -> Generator[Path, None, None]:
|
def configs(self) -> Generator[Path, None, None]:
|
||||||
|
@ -31,7 +31,7 @@ class Service:
|
||||||
|
|
||||||
for volume in self.content["volumes"]:
|
for volume in self.content["volumes"]:
|
||||||
host_part = volume.split(":")[0]
|
host_part = volume.split(":")[0]
|
||||||
cd_match = Service._RE_CONFDIR.match(host_part)
|
cd_match = Service._RE_CONFIGDIR.match(host_part)
|
||||||
|
|
||||||
if cd_match:
|
if cd_match:
|
||||||
yield Path(cd_match.group(1))
|
yield Path(cd_match.group(1))
|
||||||
|
|
|
@ -51,8 +51,8 @@ class TestDefault:
|
||||||
content=CommentedMap({
|
content=CommentedMap({
|
||||||
"image": "repo/image:tag",
|
"image": "repo/image:tag",
|
||||||
"volumes": [
|
"volumes": [
|
||||||
"${CONFDIR}/some/config:/path/to/some/config",
|
"${CONFIGDIR}/some/config:/path/to/some/config",
|
||||||
"$CONFDIR/other/config:/path/to/other/config",
|
"CONFIGDIR/other/config:/path/to/other/config",
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
parent=None,
|
parent=None,
|
||||||
|
|
Loading…
Reference in a new issue