1

I have two servers running the same set of internally developed apps. One is the "production" server, the other is the "dev/test" server. As time has gone on, the config files for the two have become more and "out of order". They mostly contain the same lines, but he values for each are different.

Here's an examples... Prod server

siteUID = server-prod
backend = prod
node = prod1
system.default.timezone = UTC

Dev Server

siteUID = server-dev
backend = dev
node = dev1
system.default.timezone = CST

So same variables, different values. As you get further down the files, the entries get more and more out of order. To be clear, the same entries are in each file (with different values), they are just in different order. Also, there are a few values on the prod server that simply don't exist on the Dev server.

I want to get these files (there's about 20 on each server, and some are several hundred lines long) sorted in the same order. Specifically, I want to make the values in config files on the Dev server match the same order as the Prod server.

Unfortunately I cannot simply sort them (say alphabetically) as these entries are often broken into specific sections (such as variables that are required by a specific release) that need to stay together.

Any idea on how I can force the Dev files to line up with the Prod files?

Egyas
  • 151
  • 2
  • 10
  • 2
    Write a script. Given the syntax, you'd grab the prod files, extract all keys in order, parse the other files as a dictionary and serialize them again based on the order of the pros ones. All in all, 20 lines of python (based on given examples). – Ginnungagap Aug 14 '23 at 20:49
  • That's certainly one option, and frankly what I suspected the answer would be. :( Sadly, my coding skills aren't up to the task so it would involve more research. – Egyas Aug 16 '23 at 19:37

0 Answers0