privatebin icon indicating copy to clipboard operation
privatebin copied to clipboard

Config exmaple or generate config?

Open douglasg14b opened this issue 1 year ago • 8 comments

There is no config generated for the CLI, and I cannot find an example config in this repo.

I need to specify a URL for the default privatebin instance to use.

What is the recommended course of action here?

douglasg14b avatar Oct 27 '24 23:10 douglasg14b

By default using a premade binary result sin:

Error: cannot load configuration: cannot open file: open /home/douglas/.config/privatebin/config.json: no such file or directory


However, adding an emoty cofnig file with an empty JSON objects results in:

Error: cannot find "" bin configuration: cannot find "" bin configuration

In this case, this issue is now a feature request to generate the config file if it does not exist since the CLI breaks if it's not generated for it.

douglasg14b avatar Oct 27 '24 23:10 douglasg14b

I tried to reverse engineer it, but still get the same error 😒

Using the example in the docs:

cat example.txt | privatebin create

{
  "bin": [
    {
      "name": "example",
      "host": "[my private instance]",
      "expire": "1week",
      "open-discussion": false,
      "burn-after-reading": false,
      "gzip": false,
      "formatter": "plaintext"
    }
  ],
  "expire": "1week",
  "open-discussion": false,
  "burn-after-reading": false,
  "gzip": false,
  "formatter": "plaintext"
}

douglasg14b avatar Oct 27 '24 23:10 douglasg14b

Looks like I needed an empty bin profile name for the default.

douglasg14b avatar Oct 28 '24 00:10 douglasg14b

Indeed, the default instance is unnamed, and you can specify other named instances using the --bin flag.

I agree that adding functionality to auto-generate a config if none exists would improve the user experience — I'll consider implementing this enhancement.

For more details on configuration, please refer to the documentation: https://github.com/gearnode/privatebin/blob/master/doc/privatebin.conf.5.md or man privatebin.conf

gearnode avatar Oct 28 '24 20:10 gearnode

@gearnode was this solved by a pr that can be linked to it?

douglasg14b avatar Oct 31 '24 15:10 douglasg14b

@douglasg14b I'll add the generator feature one day, or feel free to open a pull request to add it if you have the time. Updating the documentation to clarify that the empty string is the default for the private bin instance would also be a good improvement. However, since there’s no bug in the program, I’m closing this issue.

gearnode avatar Nov 18 '24 05:11 gearnode

@gearnode

I'm not following. Is this not a bug?

The CLI will not work out of the box unless the user fixes it. It may not be a logical defect, but it is still a behavior that degrades the user experience and requires workarounds to operate as expected.

Which constitutes the requirements for a defect. One which will not go away unless repaired 🤔

douglasg14b avatar Nov 20 '24 22:11 douglasg14b

@douglasg14b I've reopened the issue. I don't have time to work on this currently, but it's suitable for first-time contributors. My only concern about providing a default configuration is that it would promote a specific PrivateBin instance, which I'd prefer to avoid.

gearnode avatar Mar 10 '25 08:03 gearnode