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:
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 configurationdev
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:--unattended
was not passed):--[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>
)--no-auth-token
(disables setup of auth token)--auth-token
(prompts for token)--auth-token=<token>
(configured auth with<token>
)--no-timezone
(disables setup of timezone)--timezone
(prompts for timezone)--timezone=<TZ>
(configures bashrc with<TZ>
)--[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:
Don't forget to document all of this in the usage!