Choose the appropriate configuration context based on how changes will be handled by the system. When defining custom configuration variables:
PGC_POSTMASTER
for options that require a server restart or cannot be changed while the server is runningPGC_SIGHUP
only when there is code to properly handle configuration changes at runtimeExample of proper context selection:
DefineCustomStringVariable(
"neon.safekeeper_extra_conninfo_options",
"libpq keyword parameters and values to apply to safekeeper connections",
NULL,
&safekeeper_extra_conninfo_options,
"",
PGC_POSTMASTER, // Requires restart since we don't have reconnection code
...
);
// For configurations that need special handling when changed:
DefineCustomStringVariable(
"neon.safekeepers",
"List of safekeepers",
NULL,
&safekeepers_list,
"",
PGC_SIGHUP, // Can change during runtime
...
NULL, assign_neon_safekeepers, NULL // Custom handler function
);
Adding clear comments when configurations have special behavior enhances code maintainability.
Enter the URL of a public GitHub repository