kong icon indicating copy to clipboard operation
kong copied to clipboard

Load values from files if the file exist

Open mitar opened this issue 6 months ago • 3 comments

So I am thinking about managing secrets. One way to manage them is to have them stored to a file and then program reads it from a file. I am thinking that it would be nice if Kong supported first-class support for that pattern. So like there is env which can be read for a value, it could also be file pointing to a file path. And if that file path exists, the value is read from the file (and of course values could be tried in order, like first file, then env, then config, then CLI, I am not sure what is current order, but file would be in there somewhere).

Some thoughts:

  • Probably file path should be relative to some directory. Maybe file should be only a filename and then directory should be provided in some other way (maybe through Kong var or by having another flag which tells the directory, like the config flag currently loads config).
  • With secrets it is also useful to be able to rotate them. So that contents of a file is updated, and then app is signaled to re-read values from the file. So it would be useful if there was a way to tell Kong to re-read the config. Not sure if that is currently supported? But probably one can simply another instance of Kong and this is it?

mitar avatar Feb 20 '24 10:02 mitar