I am thinking of creating a config table to hold various values for the web app making it easier to change things globally later (and the client to change them, too) so I have a simple table containing just a couple of fields - configName
and configValue
. I will then store things like…
configName: 'admin_email'
configValue: 'admin@domain.com'
There probably won’t be many records but I will likely be adding to them.
I want to create a query in my globals api to get all the records and store them in an array so I can then use them easily throughout the app.
So the above example could be used like this:
config['admin_email']
to get the value of 'admin@domain.com'
.
Is this possible or does the array have to be referenced with it’s id, eg. config[1]
?
And if this is possible, what’s the best technique to achieve it and also the most efficient?
I hope this makes sense.
Last updated: