rust-lang/crates-io-ops-bot

Add a `block-ip` and `unblock-ip` command

Closed this issue · 1 comments

sgrif commented

These commands should both take an IP address as a single argument. These commands will both be manipulating the BLOCKED_IPS config var, which is a comma separated list. The variable can be read with heroku config:get BLOCKED_IPS, and written with heroku config:set BLOCKED_IPS={value}

  • block-ips should fetch the current value of the config var, and append the given value to it.
    • This command needs to handle the config var not being set as well as being empty
    • The command should error if the IP is already in the list
  • unblock-ips should fetch the current value of the config var and remove the given IP from the list.
    • If the list is empty after removal, the command should unset the config var instead of setting it to an empty string
    • The command should error if the given IP was not in the list
    • The command should gracefully handle the config var not being set (which will still result in an error, but should say the IP was not blocked, not some other runtime error)
  • These commands should not output the full value of BLOCKED_IPS, but should only confirm that the given IP has been blocked/unblocked
  • If an error occurs from either command, the error output should be emitted.

This was completed in #24