pgmoneta / pgmoneta

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

CLI: conf get | set | ls #401

Closed jesperpedersen closed 3 days ago

jesperpedersen commented 1 month 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 month ago

@MohanadKh03 Can you take this one ?

@Jubilee101 can help with core stuff

MohanadKh03 commented 1 month 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 month 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 month ago

Remember to add yourself to the authors info...

Jubilee101 commented 1 month ago

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

jesperpedersen commented 1 month 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

jesperpedersen commented 3 weeks ago

@MohanadKh03 Where are you on this ?

MohanadKh03 commented 3 weeks ago

Hey @jesperpedersen My bad I have been pretty busy and haven’t had a chance to continue working on this. It might be better if someone else takes over to keep things going and not block progress. Thanks and apologies for the late progress.

jesperpedersen commented 3 weeks ago

@MohanadKh03 Thanks for the update !

ashu3103 commented 3 weeks ago

@jesperpedersen I can continue with this issue, kindly assign me this.

jesperpedersen commented 3 weeks ago

@ashu3103 Ok, but this is an important task very soon

jesperpedersen commented 3 weeks ago

@ashu3103 You can see how it works in pgagroal - here we need to get the configuration as a JSON and then filter out the entry wanted, set is a key/value pair and then matched on the server side. conf ls is the easiest one as it just a request, and the strings in the Response part

ashu3103 commented 3 weeks ago

@ashu3103 Ok, but this is an important task very soon

Sure, I'll keep that in mind and try to wrap it quickly.

jesperpedersen commented 3 weeks ago

@ashu3103 Do conf ls first and post a draft patch