| 
									
										
										
										
											2022-07-30 03:13:47 +00:00
										 |  |  | import json | 
					
						
							|  |  |  | import os | 
					
						
							| 
									
										
										
										
											2022-07-30 04:31:17 +00:00
										 |  |  | import time | 
					
						
							| 
									
										
										
										
											2022-07-30 03:13:47 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-30 12:48:07 +00:00
										 |  |  | # open json file in docker volume | 
					
						
							| 
									
										
										
										
											2022-07-30 04:56:28 +00:00
										 |  |  | with open("/config/servers.json", "w") as f: | 
					
						
							| 
									
										
										
										
											2022-07-30 03:13:47 +00:00
										 |  |  |     print("created " + f.name) | 
					
						
							| 
									
										
										
										
											2022-07-30 12:48:07 +00:00
										 |  |  |     # template json string | 
					
						
							| 
									
										
										
										
											2022-07-30 04:56:28 +00:00
										 |  |  |     template_string = ( | 
					
						
							|  |  |  |         '{"Servers": {"1": {"Name": "DavinciResolve", ' | 
					
						
							|  |  |  |         '"Group": "Servers", "Port": 5432, "Username": ' | 
					
						
							|  |  |  |         '"postgres", "Host": "postgres", "SSLMode": "prefer", "MaintenanceDB": "postgres"}}}' | 
					
						
							|  |  |  |     ) | 
					
						
							| 
									
										
										
										
											2022-07-30 03:13:47 +00:00
										 |  |  |     data = json.loads(template_string) | 
					
						
							| 
									
										
										
										
											2022-07-30 12:48:07 +00:00
										 |  |  |     # fix username | 
					
						
							| 
									
										
										
										
											2022-07-30 04:47:06 +00:00
										 |  |  |     data["Servers"]["1"]["Username"] = os.getenv("POSTGRES_USER") | 
					
						
							| 
									
										
										
										
											2022-07-30 04:31:17 +00:00
										 |  |  |     print("printing json to file...") | 
					
						
							| 
									
										
										
										
											2022-07-30 03:13:47 +00:00
										 |  |  |     print(data) | 
					
						
							| 
									
										
										
										
											2022-07-30 12:48:07 +00:00
										 |  |  |     # update config file | 
					
						
							| 
									
										
										
										
											2022-07-30 04:31:17 +00:00
										 |  |  |     json.dump(data, f, indent=2) | 
					
						
							| 
									
										
										
										
											2022-07-30 12:48:07 +00:00
										 |  |  | # Sleep until GHA Healthchecks are complete. | 
					
						
							|  |  |  | # I'm sure there's a better way to get this to not | 
					
						
							|  |  |  | # stall a docker-compose up --wait, but I don't know | 
					
						
							|  |  |  | # what it is | 
					
						
							| 
									
										
										
										
											2022-07-30 05:00:03 +00:00
										 |  |  | time.sleep(125) |