0

I'm making a vpn service that can be controlled through admin web page.

So I have a web page that consists of front-end page and a backend API + DB.

In this admin web page, I can execute a vpn binary at my server by clicking a button or submitting a form. And also set some configurations before I start my vpn-service.

And this configurations needs to be written in file which then passed to vpn binary by an argument(params).

I'm kinda confused because in web app, I store configurations in DB but then it needs to be copied to the config file for a binary to receive. It looks like violating SSOT(Single Source of Truth). Hard to manage its sync status.

How should I manage its config in this situation? Maybe I can skip DB and just use file as if it were DB. Or maybe when I start vpn, always overwrite config with current DB values so that it never matters?

1 Answer 1

3

I'm kinda confused because in web app, I store configurations in DB but then it needs to be copied to the config file for a binary to receive. It looks like violating SSOT(Single Source of Truth). Hard to manage its sync status.

SSOT does not mean you cannot have (non-authoritative) copies of some data. Otherwise, just showing the configuration data to your user would be a violation of SSOT (because the web-page would contain a second copy).

If you designate the database as your SSOT, then the file passed to the binary should be regarded as a non-authoritative copy and it should be re-generated at least every time a potential change has been made to the database. Easiest would be to generate a new (temporary) file each time the binary needs to be invoked.

Another option would be to designate the configuration file as the SSOT and leave the configuration completely out of the database.

Not the answer you're looking for? Browse other questions tagged or ask your own question.