mrchainman / Gotify-Nextcloud

A python script that fetches notifications from the nextcloud talk api and pushes them to a gotify server.
GNU General Public License v2.0
11 stars 4 forks source link

Add possibility to use environment variables #6

Open junpet opened 4 years ago

junpet commented 4 years ago

You can use environment variables instead of storing passwords in config.py as plaintext. Note that settings.py is still needed, because this file reads the environment variables.

Changes in settings.py:

Some minimal adjustments in push_msg.py:

mrchainman commented 4 years ago

Hi @junpet thanks for your work. Can you confirm, that using environment variables works also with special characters in passwords, i.e. quotes etc.?

EDIT: I just tried running it, but the environment variables are not being read. Which shell did you use?

junpet commented 4 years ago

Hi @mrchainman!

Sorry for late answer. I used VSCode on Windows with Python 3 dev container. It looks like this container uses bash. I've created environment variables with the following command:

export NEXTCLOUD_URL="https://cloud.mydomain.com"

I think you can use special characters in the password. IIRC you need to escape $ character, and you can't use = and NUL, but I haven't tested. See more.

BTW, I've created a docker branch as well and I run this script in a container for some time, working like a charm.

mrchainman commented 4 years ago

@junpet alright, i will retest it and report back.

mrchainman commented 3 years ago

@junpet Sorry, still didn't geht around testing, have a lot going on right now... Would you be interested in maintaining this project?

junpet commented 3 years ago

@mrchainman Unfortunately I have not much time either, so it wouldn't be much difference if I would maintain this project. Just keep it. Don't worry about merging this. You'll do it if you have time. :) Have a nice day. :)