Skip to content

Commit

Permalink
Don't output vars for normal runs, default SVG to false
Browse files Browse the repository at this point in the history
  • Loading branch information
thespad committed Nov 25, 2024
1 parent 14c3044 commit 043d6cf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ If you need to test functionality just run:

```bash
docker pull lscr.io/linuxserver/d2-builder:latest && \
docker run -d --rm -v /tmp/d2:/output -e PUID=1000 -e PGID=1000 lscr.io/linuxserver/d2-builder:latest mastodon:latest
docker run -d --rm -v /tmp/d2:/output -e PUID=1000 -e PGID=1000 -e SVG=true lscr.io/linuxserver/d2-builder:latest mastodon:latest
```

Generated svg files will be created in `/output`.
Expand Down
2 changes: 1 addition & 1 deletion readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ full_custom_readme: |
```bash
docker pull lscr.io/linuxserver/d2-builder:latest && \
docker run -d --rm -v /tmp/d2:/output -e PUID=1000 -e PGID=1000 lscr.io/linuxserver/d2-builder:latest mastodon:latest
docker run -d --rm -v /tmp/d2:/output -e PUID=1000 -e PGID=1000 -e SVG=true lscr.io/linuxserver/d2-builder:latest mastodon:latest
```
Generated svg files will be created in `/output`.
Expand Down
2 changes: 2 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/init-d2-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ done

shopt -s globstar

if [[ -n ${SVG} ]]; then
cat <<EOF > "/output/${OUTPUTNAME}"
vars: {
d2-config: {
Expand All @@ -107,6 +108,7 @@ vars: {
}

EOF
fi

echo "\"${IMAGENAME}:${TAGNAME}\": {" >> "/output/${OUTPUTNAME}"

Expand Down
2 changes: 1 addition & 1 deletion root/etc/s6-overlay/s6-rc.d/init-d2-output/run
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ else
OUTPUTNAME="${IMAGENAME}-${TAGNAME}"
fi

if [[ -z ${RAW} ]]; then
if [[ -n ${SVG} ]]; then
s6-setuidgid abc d2 "/output/${OUTPUTNAME}.d2" "/output/${OUTPUTNAME}.svg"
chmod 644 "/output/${OUTPUTNAME}.d2" "/output/${OUTPUTNAME}.svg"
else
Expand Down

0 comments on commit 043d6cf

Please sign in to comment.