-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to pass Caddyfile config via environment variable #248
base: master
Are you sure you want to change the base?
Changes from all commits
de5c56f
8b43080
1f09ff5
c403f71
5ad130b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# Check if Caddyfile config is passed via $CADDYFILE | ||
if [[ "$CADDYFILE" ]]; then | ||
echo 'Storing $CADDYFILE variable to ./Caddyfile' | ||
printf "$CADDYFILE" > Caddyfile # echo doesn't preserve newlines | ||
fi | ||
|
||
# Running passed command | ||
if [[ "$1" ]]; then | ||
exec "$@" | ||
fi | ||
Comment on lines
+10
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will be true all the time (custom If the Is the check for args (command) being provided serving any real purpose? (could just |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this run from the
WORKDIR
that is set to/srv
? While the--config
forCMD
is set to/etc/caddy/Caddyfile
? Is that intentional?NOTE: the ENV check is using
[[ ... ]]
, this isbash
specific and not supported by plainsh
AFAIK. In this case/bin/sh
is symlinked tobusybox
;ash
also symlinks to that -busybox
is compatible with this syntax, although it wouldn't hurt to instead use#! /bin/ash
though? :)Have you tested that this is working correctly? Surely you're changing the
CMD
on your end if that is the case?