Storing and retrieving a secret API key in a server build?
I have a REST api that requires a secret key to use, how should I got about storing this key in a way that only server builds have access to it, and that allows me to access it from blueprints?
asked Jul 01 '18 at 09:50 AM in Using UE4
Use INI files and don't replicate, make sure it runs on server and only server engine ini has it (don't place key in default config)
Use of INI files is very limited in blueprint, but at least you can read variable from it. You can click variable and extend property tab, there should be Config Variable Checkbox, this will make engine grab default value from INI file on object creation. The INI location where this variable will be loaded from is printed out on tooltip when you hover over the config checkbox. The variable name in INI should be the same as in the blueprint, im not 100% the bool variable might require "b" prefix, also don't make variables name with spaces.
Thats all you can do with INIs in blueprint (without any plugins) for more you need to dive in to C++:
^^^^ it will work the same as in blueprint but in C++ you can call LoadConfig() and SaveConfig() on object with config varbales to load and save those variable states from/to INI anytime. You can also more directly edit INI files:
All GConfig functions:
Follow this question
Once you sign in you will be able to subscribe for any updates here