ctfcli icon indicating copy to clipboard operation
ctfcli copied to clipboard

Ability to set CTFd config

Open ColdHeat opened this issue 3 years ago • 4 comments

We need a way to share CTFd configuration between events. It's too easy to forget that a configuration setting needs to be set.

ColdHeat avatar Apr 30 '22 22:04 ColdHeat

I have interest in this specific issue and may be able to help. Would you accept a PR on this? If so, do you have any recommendations regarding potential implementations?

SmylerMC avatar Sep 06 '23 08:09 SmylerMC

@SmylerMC yes I would accept a PR for this.

I don't think there's much trick to it but I am concerned that in the .ctf/config file we already use the config key.

Ideally I think that we would want this to be something like:

[config]
ctf_name = CTFd
challenge_visibility = public

Perhaps that means that we rename the top level config to something else.

ColdHeat avatar Sep 06 '23 22:09 ColdHeat

What about using YAML for the CTFd config file? I feel like that would make things more coherent, ctfcli related files being in TOML and CTFd related files in YAML.

Regarding the commands, I like the idea of changing ctf config to work with CTFd's config if you are ok with that. I assumed it was what it did the first time had a look at ctfcli.

SmylerMC avatar Sep 07 '23 07:09 SmylerMC

Another solution I was tinkering with for the commands would be to keep ctf config as it is and add a new ctf instance command that would manage CTFd's state as a whole through sub-commands.

Example sub-commands could be:

  • ctf instance config save -> Save the current CTFd configuration to a local file
  • ctf instance config apply -> Apply the configuration specified in a dedicated file in the project
  • ctf instance config get [key] -> Get a single config entry
  • ctf instance config set [key] [value] -> Set a single config entry
  • ctf instance reset [accounts|submissions|challenges|pages|notification] -> Delete all selected data
  • ctf instance export -> Backup CTFd
  • ctf instance import -> Restore CTFd backup

SmylerMC avatar Sep 07 '23 12:09 SmylerMC