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

Dev haokang #11

Merged
merged 2 commits into from
Aug 7, 2018
Merged

Dev haokang #11

merged 2 commits into from
Aug 7, 2018

Conversation

dustinke11
Copy link

No description provided.

@dustinke11
Copy link
Author

@bittopaz

@@ -95,8 +96,71 @@ func EcsClient() (client *ecs.Client) {
return client
}

func NewRedisClient() (client *r_kvstore.Client) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use https://golang.org/doc/effective_go.html#embedding to do some refactoring on this part.

We can create a base struct

type Client struct {
    Config alicloud.Config
}

type EcsClient struct {
    *Client
}

type RedisClient struct {
    *Client
}

if os.Getenv("ALICLOUD_DEFAULT_REGION") == "" ||
os.Getenv("ALICLOUD_ACCESS_KEY") == "" ||
os.Getenv("ALICLOUD_SECRET_KEY") == "" {
//get rolename
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the credential management, you can refer here https://github.com/aws/aws-sdk-go/tree/master/aws/credentials and learn from it.

}
}

func getEnv(input string) (output string) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename it to splitEnvFromName

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants