Proppy code review feedback.

Signed-off-by: Dan Lorenc <lorenc.d@gmail.com>
This commit is contained in:
Dan Lorenc 2014-12-16 09:35:30 -08:00
parent 17d8b16a37
commit 5525cf9f6f
2 changed files with 15 additions and 10 deletions

View File

@ -17,6 +17,8 @@ import (
)
const (
AuthURL = "https://accounts.google.com/o/oauth2/auth"
TokenURL = "https://accounts.google.com/o/oauth2/token"
ClientId = "22738965389-8arp8bah3uln9eoenproamovfjj1ac33.apps.googleusercontent.com"
ClientSecret = "qApc3amTyr5wI74vVrRWAfC_"
)
@ -32,8 +34,8 @@ func newOauthClient(storePath string) *http.Client {
ClientId: ClientId,
ClientSecret: ClientSecret,
Scope: raw.ComputeScope,
AuthURL: "https://accounts.google.com/o/oauth2/auth",
TokenURL: "https://accounts.google.com/o/oauth2/token",
AuthURL: AuthURL,
TokenURL: TokenURL,
}
token := token(storePath, config)
t := oauth.Transport{
@ -91,8 +93,9 @@ func tokenFromWeb(config *oauth.Config) *oauth.Token {
config.RedirectURL = ts.URL
authURL := config.AuthCodeURL(randState)
log.Infof("Opening auth URL in browser. If the URL doesn't open, please open it manually and copy the code here.")
log.Info("Opening auth URL in browser.")
log.Info(authURL)
log.Info("If the URL doesn't open, please open it manually and copy the code here.")
go openURL(authURL)
go getCodeFromStdin(ch)

View File

@ -24,10 +24,12 @@ type ComputeUtil struct {
}
const (
apiURL = "https://www.googleapis.com/compute/v1/projects/"
imageName = "https://www.googleapis.com/compute/v1/projects/google-containers/global/images/container-vm-v20141016"
dockerUrl = "https://bfirsh.s3.amazonaws.com/docker/docker-1.3.1-dev-identity-auth"
firewallRule = "docker-machines"
apiURL = "https://www.googleapis.com/compute/v1/projects/"
imageName = "https://www.googleapis.com/compute/v1/projects/google-containers/global/images/container-vm-v20141016"
dockerUrl = "https://bfirsh.s3.amazonaws.com/docker/docker-1.3.1-dev-identity-auth"
firewallRule = "docker-machines"
port = "2376"
firewallTargetTag = "docker-machine"
)
// NewComputeUtil creates and initializes a ComputeUtil.
@ -79,7 +81,7 @@ func (c *ComputeUtil) createFirewallRule() error {
{
IPProtocol: "tcp",
Ports: []string{
"2376",
port,
},
},
},
@ -87,7 +89,7 @@ func (c *ComputeUtil) createFirewallRule() error {
"0.0.0.0/0",
},
TargetTags: []string{
"docker-machine",
firewallTargetTag,
},
Name: firewallRule,
}
@ -135,7 +137,7 @@ func (c *ComputeUtil) createInstance(d *Driver) error {
},
Tags: &raw.Tags{
Items: []string{
"docker-machine",
firewallTargetTag,
},
},
}