Skip to content

Commit

Permalink
Revert "add Newconf to create a new client , modify getDefaultOssConf…
Browse files Browse the repository at this point in the history
…ig to GetDefaultOssConfig."

This reverts commit ae399e2.
  • Loading branch information
king41409 committed Apr 12, 2019
1 parent ae399e2 commit 47cce83
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 45 deletions.
45 changes: 1 addition & 44 deletions oss/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,50 +40,7 @@ type (
//
func New(endpoint, accessKeyID, accessKeySecret string, options ...ClientOption) (*Client, error) {
// Configuration
config := GetDefaultOssConfig()
config.Endpoint = endpoint
config.AccessKeyID = accessKeyID
config.AccessKeySecret = accessKeySecret

// URL parse
url := &urlMaker{}
url.Init(config.Endpoint, config.IsCname, config.IsUseProxy)

// HTTP connect
conn := &Conn{config: config, url: url}

// OSS client
client := &Client{
Config: config,
Conn: conn,
}

// Client options parse
for _, option := range options {
option(client)
}

// Create HTTP connection
err := conn.init(config, url, client.HTTPClient)

return client, err
}

// New creates a new client.
//
// endpoint the OSS datacenter endpoint such as http://oss-cn-hangzhou.aliyuncs.com .
// accessKeyId access key Id.
// accessKeySecret access key secret.
// config Configuration
//
// Client creates the new client instance, the returned value is valid when error is nil.
// error it's nil if no error, otherwise it's an error object.
//
func Newconf(endpoint, accessKeyID, accessKeySecret string, config *Config, options ...ClientOption) (*Client, error) {
// Configuration
if config == nil {
config = GetDefaultOssConfig()
}
config := getDefaultOssConfig()
config.Endpoint = endpoint
config.AccessKeyID = accessKeyID
config.AccessKeySecret = accessKeySecret
Expand Down
2 changes: 1 addition & 1 deletion oss/conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (config *Config) WriteLog(LogLevel int, format string, a ...interface{}) {
}

// getDefaultOssConfig gets the default configuration.
func GetDefaultOssConfig() *Config {
func getDefaultOssConfig() *Config {
config := Config{}

config.Endpoint = ""
Expand Down

0 comments on commit 47cce83

Please sign in to comment.