Allow Setting Defaults
jaruba opened this issue · 4 comments
Scenario
The current proposed command is ./cli/beamup <beamup deployer hostname> add-remote <github username> <addon name>
IMO this is an issue, as addon devs will always need to search for the hostname and add their github user every time they initiate a new addon.
Proposed Solution
beamup --set-server <hostname> --set-user <github user>
to set both the server and user as the default for all future use.
Another thought I have about this is that we could save this data in JSON, example:
{
"server": "...",
"github": "..."
}
We could use beamup --set-server <hostname> --set-user <github user>
to create a global beamup.json
, but also allow creating a beamup.json
in the project folder (that users will want to deploy) to allow setting per project settings.
The good thing about this is that it's scalable to any number of future settings we might add.
Further thoughts:
grep
could be used to extract JSON values from files, see:
https://stackoverflow.com/questions/1955505/parsing-json-with-unix-tools#answer-6852427- as we currently have few values to save, we could just use
echo
and save JSON by simply hardcoding it, see: https://stackoverflow.com/questions/39895965/how-to-write-json-file-using-bash#answer-39896024 - maybe it's enough to just write this data to the project directory (for now), users could then just copy / paste
beamup.json
to a different project to keep the settings
My final thoughts on this:
- server and github user should be set separately with
beamup config <server> <github>
and used globally - if running
beamup
without a config file, it should ask for a server and github itself and create the config file beamup init
should createbeamup.json
in the project folder with the project folder name as the addon name, alternativelybeamup init <addon name>
can be used to create abeamup.json
file with a custom addon name- if running
beamup
and there is a config file available, but not abeamup.json
in the project's path, then it should ask if the project folder name should be used as the addon name, if agreed (or set to a different value) then abeamup.json
file will be created and the process will continue
This should make it as simple as just using beamup
to deploy, or init, or even config, as this one command will handle all possible scenarios.
A separate project has been built for this purpose: beamup-cli