all looks well, except for the options… i want to change the options from the “configuration” page
But how can i read those values with the python script i launch ?
in my Dockerfile i have :
COPY run.sh /
COPY script.py /
COPY config.json /
in my run.sh file i launch the script.py file …, in my script.py file i have
with open("config.json", mode="r") as data_file:
config = json.load(data_file)
it works, bit it loads the default values already stored in the config.json, not the ones i change when save/change it on the addon configuration save, quite obbvious…
How can i manage this? not sure where i need to read that options with python?, cause its reading the file from the local folder
This goes in your run.sh
That /data/options.json file gets created automatically when the user sets the config options in the UI, you don’t need to create it.
In your actual addon code you can load it as such:
(i don’t know now any python so this is a javascript example)
const options = require("./options");
console.log(options); // for debugging purpose only
There is no options.json file for the addon/docker options. That file is called config.json. Your selfdefined options are an object/field within that file.