mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
79bedc4f46
This fix updates aws-sdk-go and go-ini to recent versions. The aws-sdk-go used to be `v1.4.22` which was more than a year old, and go-ini used to be pre-1.0 release. This fix updates aws-sdk-go to v1.12.66 and go-ini to v1.25.4: ``` github.com/aws/aws-sdk-go v1.12.66 github.com/go-ini/ini v1.25.4 ``` Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
40 lines
1,008 B
Go
40 lines
1,008 B
Go
package shareddefaults
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"runtime"
|
|
)
|
|
|
|
// SharedCredentialsFilename returns the SDK's default file path
|
|
// for the shared credentials file.
|
|
//
|
|
// Builds the shared config file path based on the OS's platform.
|
|
//
|
|
// - Linux/Unix: $HOME/.aws/credentials
|
|
// - Windows: %USERPROFILE%\.aws\credentials
|
|
func SharedCredentialsFilename() string {
|
|
return filepath.Join(UserHomeDir(), ".aws", "credentials")
|
|
}
|
|
|
|
// SharedConfigFilename returns the SDK's default file path for
|
|
// the shared config file.
|
|
//
|
|
// Builds the shared config file path based on the OS's platform.
|
|
//
|
|
// - Linux/Unix: $HOME/.aws/config
|
|
// - Windows: %USERPROFILE%\.aws\config
|
|
func SharedConfigFilename() string {
|
|
return filepath.Join(UserHomeDir(), ".aws", "config")
|
|
}
|
|
|
|
// UserHomeDir returns the home directory for the user the process is
|
|
// running under.
|
|
func UserHomeDir() string {
|
|
if runtime.GOOS == "windows" { // Windows
|
|
return os.Getenv("USERPROFILE")
|
|
}
|
|
|
|
// *nix
|
|
return os.Getenv("HOME")
|
|
}
|