How do you structure config data in a database?

后端 未结 18 1300
后悔当初
后悔当初 2021-01-31 04:37

What is people\'s prefered method of storing application configuration data in a database. From having done this in the past myself, I\'ve utilised two ways of doing it.

18条回答
  •  庸人自扰
    2021-01-31 04:56

    At my company, we're working on using option one (a simple dictionary-like table) with a twist. We're allowing for string substitution using tokens which contain the name of the config variable to be substituted.

    For example, the table might contain rows ('database connection string', 'jdbc://%host%...') and ('host', 'foobar'). Encapsulating that with a simple service or stored procedure layer allows for an extremely simple, but flexible, recursive configuration. It supports our need to have multiple isolated environments (dev, test, prod, etc).

提交回复
热议问题