Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to set CTFd config #89

Closed
ColdHeat opened this issue Apr 30, 2022 · 6 comments · Fixed by #155
Closed

Ability to set CTFd config #89

ColdHeat opened this issue Apr 30, 2022 · 6 comments · Fixed by #155

Comments

@ColdHeat
Copy link
Member

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

@SmylerMC
Copy link

SmylerMC commented Sep 6, 2023

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?

@ColdHeat
Copy link
Member Author

ColdHeat commented Sep 6, 2023

@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.

@SmylerMC
Copy link

SmylerMC commented Sep 7, 2023

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
Copy link

SmylerMC commented Sep 7, 2023

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

@ColdHeat
Copy link
Member Author

I am working on this now. I like the idea of the instance subcommand.

The issue I've run into now is that the .ctf/config structure is pretty bad because it is ini based and the server config stores a variety of things.

@ColdHeat
Copy link
Member Author

Well by the structure of the Configs model both key and value should be strings or null so I suppose we can work with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants