-
Notifications
You must be signed in to change notification settings - Fork 61
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
Interactive init #5
Conversation
…sion service, domain and backend during initialization.
02a073d
to
25c3c8f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few questions and nits, but with those acknowledged, seems reasonable.
Man but testing is tedious, eh?
|
||
var ( | ||
gitRepositoryRegEx = regexp.MustCompile(`((git|ssh|http(s)?)|(git@[\w\.]+))(:(//)?)([\w\.@\:/\-~]+)(\.git)(/)?`) | ||
domainNameRegEx = regexp.MustCompile(`(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid this is incomplete, but I don't have the strength/knowledge/intelligence to test it. Does it come from some known source? Is it possible to be abused?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed the most robust in the top SO response for this question, however I agree with you that it could be brittle and I'm sad the Go standard library doesn't offer something such as how you can parse and validate IP addresses.
* Bump go-fastly to v1.7.0 * Add golang-petname dep * Add NullProgress writer * Add UndoStack to pkg/common * Persist user email to global config file * Make `compute init` accept input interactively and add logic to provision service, domain and backend during initialization. * Surpress gosec G307 on file.Close() defers * Add RunIfError method to UndoStack which unwinds the stack if passed an error * Add text.Description() output helper to print term:description groupings. * Refactor compute init to use new helpers
TL;DR
Refactors
compute init
to accept its input interactively and act as a setup wizard to provision a service, backend and domain.Why?
We have observed friction in user testing and feedback that a users has to create a service then attach a domain and backend before a compute package can be deployed and activated. If you are new to Fastly this may be confusing. Therefore, we think that provisioning all of this for you within a single command will reduce this on-boarding friction.
What?
fastly configure
to persist user email to global config file so that it can be read bycompute init
for default author email.NullProgress
writer which swallows all writesUndoStack
which we use to teardown any state we have created in the API if an error occurs.golang-petname
dep to randomly generate nice domain namesExample: