pgmoneta / pgmoneta

Backup / restore solution for PostgreSQL
https://pgmoneta.github.io
BSD 3-Clause "New" or "Revised" License
149 stars 42 forks source link

CLI: conf get | set | ls #401

Open jesperpedersen opened 1 week ago

jesperpedersen commented 1 week ago

Create a port of pgagroal's

  conf <action>            Manages the configuration (e.g., reloads the configuration
                           The subcommand <action> can be:
                           - 'reload' to issue a configuration reload;
                           - 'get' to obtain information about a runtime configuration value;
                                   conf get <parameter_name>
                           - 'set' to modify a configuration value;
                                   conf set <parameter_name> <parameter_value>;
                           - 'ls'  lists the configuration files used.

functionality.

We have reload already

jesperpedersen commented 1 week ago

@MohanadKh03 Can you take this one ?

@Jubilee101 can help with core stuff

MohanadKh03 commented 1 week ago

Sure! Regarding the networking part though when writing the commands into pgmoneta's socket should it be the same as pgagroal's way ? I can see some pattern but correct me if im wrong 1.Send the header 2.Send the size of the payload 3.Send the payload itself 4.Read the response as a json 5.Extract whatever needed and then print it out in the console

Is that correct ? assuming no failures/errors in any of the steps

jesperpedersen commented 1 week ago

Yes, the pgmoneta way is the new way of doing it, so you need to extract information from the "Response" part of the JSON payload based on the input. That is the easy part - think of conf get as a simple https://jqlang.github.io/jq/ command.

The harder part is the conf set command, but it shouldn't be that hard either - we need to send a request with the key and the new value

jesperpedersen commented 1 week ago

Remember to add yourself to the authors info...

Jubilee101 commented 1 week ago

Just let me know if you need anything, welcome! @MohanadKh03

jesperpedersen commented 4 days ago

Yes, lets get the full solution now because we need a chapter in the advanced manual that describes how to get the configuration, a field and how to set a field.

The manual work can be separate from this