Open Blink515 opened 6 years ago
Its basically some kind of modification to this line. However, the modification itself is a little bit tricky. I can't simply check to see if a configuration file exists and then prevent overwriting. The problem is that I can't be sure that any particular user-made configuration file is setup correctly, which is why it is re-written. The configuration file is pretty simple (its just this line) but its important to have the the password/anonymous directory paths be known to FIND3 so it can be secured by adding new passwords.
I don't know how to go about this. Should the FIND3 server alert the user to a default configuration and trust the user to write it correctly? Should it then check the configuration? I also don't use mosquitto in this way so I would need some help for this because I can't really test anything that I'd write. But I'm open to helping make this happen in any way I can.
I'm wondering if you could add something like what I pasted below and have an external file be included into the main mosquitto conf file. The file location can be specified using a Docker environment variable.
From: https://mosquitto.org/man/mosquitto-conf-5.html#
include_dir dir
External configuration files may be included by using the include_dir option. This defines a directory that will be searched for config files. All files that end in '.conf' will be loaded as a configuration file. It is best to have this as the last option in the main file. This option will only be processed from the main configuration file. The directory specified must not contain the main configuration file.
you could solve this with an environment variable, in one of two ways. Either:
include_dir
to the config (as @Blink515 suggested) like MQTT_ADD_CONFIG_FILE
orMQTT_KEEP_CUSTOM_CONFIG
It's like telling the program "I know what i'm doing so let me do it". If the user then borks their config, it's their own fault and they probably know it.
I am trying to setup the Find3 MQTT broker to bridge with another one of my MQTT brokers. I have the config file setup the way I need it but every time the Find3 docker container is run it will overwrite the config file with the default contents.
I looked through the Docker file but I am not familiar enough with Docker to figure how to not overwrite the file.