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

Update first_time_setup to allow taking parameters on the commandline #84

Open
za419 opened this issue Jan 22, 2021 · 0 comments
Open
Labels
enhancement future For deferred issues (which will not be worked on yet, but are worth implementing someday) quality-of-life Small issues which don't add functionality, but improve things from a development standpoint shell Issues or pull requests which involve changes to the Bash shell scripts supporting the bot

Comments

@za419
Copy link
Owner

za419 commented Jan 22, 2021

In order to support more automated flows, as well as a variety of environments, enhance first_time_setup to support taking input on the commandline rather than stdin.

  • --type=[dev|test|prod] controls the server configuration
    • dev includes dev dependencies, but not hook setup.
    • test sets 'NODE_ENV=production' in the bashrc and before running setup, to avoid installing dev dependencies. It also skips hook setup.
    • prod, which is the default, will set production node_env, and will configure npm hooks to ensure dependencies are always up to date. It also sets the default value of autostart-on-reboot to 'yes'
  • --unattended will skip all prompts, and will proceed with whatever option does not require input or whatever the default option is for the setting at hand if no input is required at all. That is to say, unless options are provided on the commandline:
    • log mailing will be disabled (no way to get a destination email or subject prefix)
    • Discord auth will be left unconfigured (no way to get a token)
    • The timezone will be left unset (no way to get a timezone)
    • Autostart will be configured for server type prod, but left unset for others.
  • The ability to answer prompts that would be given normally via command line parameter (we should support providing these partially and prompt for the unpassed values if --unattended was not passed):
    • For log mailing:
      • --[no-]log-mailing (on/off switch, on implied by presence of either of the other two)
      • --mail-to=<email> (sets the address to send logs to <email>)
      • --mail-subject=<prefix> (sets the mail prefix to <prefix>)
    • For Discord authentication:
      • --no-auth-token (disables setup of auth token)
      • --auth-token (prompts for token)
      • --auth-token=<token> (configured auth with <token>)
    • For timezone:
      • --no-timezone (disables setup of timezone)
      • --timezone (prompts for timezone)
      • --timezone=<TZ> (configures bashrc with <TZ>)
    • For autostart:
      • --[no-]start-on-boot (on/off switch for start-on-boot - Should this be --autostart?)

The end goal is that one could theoretically perform a setup by remote invocation of something like:

/path/to/CadenceBot/first_time_setup.sh --type=prod --unattended --mail-to=me@example.com --mail-subject=CadenceBot \
                                        --auth-token=$(cat prod-token) --timezone=America/Chicago

Don't forget to document all of this in the usage!

@za419 za419 added enhancement future For deferred issues (which will not be worked on yet, but are worth implementing someday) quality-of-life Small issues which don't add functionality, but improve things from a development standpoint shell Issues or pull requests which involve changes to the Bash shell scripts supporting the bot labels Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement future For deferred issues (which will not be worked on yet, but are worth implementing someday) quality-of-life Small issues which don't add functionality, but improve things from a development standpoint shell Issues or pull requests which involve changes to the Bash shell scripts supporting the bot
Projects
None yet
Development

No branches or pull requests

1 participant