Skip to content
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

Automatically determine if app.conf exists in 40-config #18

Closed
rickcaudill opened this issue Mar 8, 2019 · 5 comments
Closed

Automatically determine if app.conf exists in 40-config #18

rickcaudill opened this issue Mar 8, 2019 · 5 comments
Assignees
Labels

Comments

@rickcaudill
Copy link

DuckDNS: Automatically determine if app.conf exists in 40-config. This would allow the user to specify there config through command line args or by extending the base image and copying the file over. This would mean the user would not need to pass token or domains through command line interface. I could submit PR if thought to be a good idea!

@aptalca aptalca added this to To do in Issue & PR Tracker via automation Mar 8, 2019
@aptalca aptalca self-assigned this Mar 8, 2019
@aptalca
Copy link
Member

aptalca commented Mar 11, 2019

I don't quite follow. /app/duck.conf is only used as temp storage because cron doesn't access the env vars. If the file exists, the env vars are already set. There is no point in checking if it exists and retrieving from the file because the file is inside the container and is created and destroyed along with it.

If you mean you want it to reside in the config folder so you can create a container without defining the token and subdomain, then this image was really meant to use no config folder. Config folder was only added as an option to save the logs to. In that case, I think you'd be better off using docker compose and putting the token and subdomains in an env file.

Or perhaps I'm way off because I don't quite understand your use case. You say This would allow the user to specify there config through command line args but that's already possible by using vars in either docker run/create or the compose yaml. I don't know what you mean by or by extending the base image and copying the file over

@homerr homerr moved this from To do to PRs & in progress issues in Issue & PR Tracker Mar 11, 2019
@rickcaudill
Copy link
Author

The way that I use this container is different than what the container was meant for. I don't want to pass to the command line any args nor do I want to use docker compose. So I have modified the init script to check if app/duck.conf exists. If it does then it will source in this file immediately. If it doesn't then I take the steps the original image had created:

Example:
if [ ! -f /app/duck.conf ]; then
#Check to make sure the subdomain and token are set
if [ -z "$SUBDOMAINS" ] || [ -z "$TOKEN" ]; then
echo "Please pass both your subdomain(s) and token as environment variables in your docker run command. See docker info for more details."
exit 1
else
echo "Retrieving subdomain and token from the environment variables"
echo -e "SUBDOMAINS=$SUBDOMAINS TOKEN=$TOKEN" > /app/duck.conf
fi
else
. /app/duck.conf
fi

Then in my Dockerfile I do the following:

from linuxserver/duckdns

#right now without this being in the base images 40-config:
COPY etc/cont-init.d/* /etc/cont-init.d/

COPY app/duck.conf /app/duck.conf

What this means is I can maintain an internal git repo with everything and just run docker build.

@aptalca
Copy link
Member

aptalca commented Mar 12, 2019

Nevermind what steps you took to get around the issue. I'm trying to understand what you're trying to accomplish and why.

So you just want to pass the token and the subdomains via a file on your host instead of env variables in the docker run?
You still don't say why you need that, but here's what you can do: https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file
Put your vars in a .env file on your host and reference it in your docker run.

If your intention is to build your own images locally anyway (not clear from your messages if that's the intention), then just fork it and commit your changes before you build it.

@rickcaudill
Copy link
Author

Thanks for your feedback. I agree that I could use a .env file however Portainer does not have this ability yet and I like using GUIs to deploy my containers. Thanks for your help; however I like my method will just maintain my own changes. Thanks

@aptalca
Copy link
Member

aptalca commented Mar 12, 2019

Again, I still have no idea what your main motivation behind not wanting to pass env variables is, you are using portainer and you say you prefer GUIs to deploy, so you can add your env variables right there on Portainer. So I'm going to leave it at "we don't support what you're asking for"

@aptalca aptalca closed this as completed Mar 12, 2019
Issue & PR Tracker automation moved this from PRs & in progress issues to Done Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

2 participants