aws-oidc/config_darwin.go
Jeremy Stott f8a7c0986f Added TOML cofiguration file support
* configuration file located at ~/.aws-oidc/config
 * sets default parameters, but can still be overridden on the cli
 * named AuthProviders are accessible via the auth [name] command
Renamed exec command to auth. Upgraded auth command to take defaults from the config file.
Added new command exec, that puts the temporary credentials as environment variables in the specified command
Automatically append URL to end of auth command if not specified
2019-04-24 15:34:01 +12:00

32 lines
635 B
Go

package main
import (
"os"
"os/user"
"path/filepath"
)
func homeDir() string {
if currentUser, err := user.Current(); err == nil {
return currentUser.HomeDir
}
return ""
}
func execDir() string {
if currentExecutable, err := os.Executable(); err == nil {
return filepath.Dir(currentExecutable)
}
return ""
}
// GetConfigFilePath returns the path of the configuration file
func GetConfigFilePath() string {
return filepath.Join(homeDir(), ".aws-oidc/config")
}
// GetLogPath returns the path that should be used to store logs
func GetLogPath() string {
return filepath.Join(homeDir(), "Library/Logs/aws-oidc.log")
}