get S3 profile using env AWS_PROFILE
This commit is contained in:
parent
f777c78aad
commit
3823b1bf44
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
const versionStr = "0.9.0"
|
const versionStr = "0.9.1"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
versionCmd = &cobra.Command{
|
versionCmd = &cobra.Command{
|
||||||
|
@ -12,6 +12,10 @@ For the main config file to be fetched remotely, pass the URL using `-f [url]`.
|
|||||||
|
|
||||||
If using S3, you should use the s3 protocol URI: `s3://bucketName/key/path`. You will also need to set the env variable `S3_ENDPOINT` to the appropriate value. The flag `--s3-endpoint` can be used to override this value or to set this value, if not already set.
|
If using S3, you should use the s3 protocol URI: `s3://bucketName/key/path`. You will also need to set the env variable `S3_ENDPOINT` to the appropriate value. The flag `--s3-endpoint` can be used to override this value or to set this value, if not already set.
|
||||||
|
|
||||||
|
## Authentication
|
||||||
|
|
||||||
|
Currently, only the AWS authentication credentials file `~/.aws/credentials` is supported. For now, the environment variable `AWS_PROFILE` is used to lookup the profile.
|
||||||
|
|
||||||
## Scripts
|
## Scripts
|
||||||
|
|
||||||
Remote script support is currently limited to http/https endpoints.
|
Remote script support is currently limited to http/https endpoints.
|
@ -44,9 +44,8 @@ func NewS3Fetcher(endpoint string, options ...FetcherOption) (*S3Fetcher, error)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
s3Endpoint := os.Getenv("S3_ENDPOINT")
|
s3Endpoint := os.Getenv("S3_ENDPOINT")
|
||||||
creds, err := getS3Credentials("default", s3Endpoint, cfg.HTTPClient)
|
creds, err := getS3Credentials(os.Getenv("AWS_PROFILE"), s3Endpoint, cfg.HTTPClient)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
println(err.Error())
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +132,7 @@ func getS3Credentials(profile, host string, httpClient *http.Client) (*credentia
|
|||||||
if hdirErr != nil {
|
if hdirErr != nil {
|
||||||
return nil, hdirErr
|
return nil, hdirErr
|
||||||
}
|
}
|
||||||
s3Creds := credentials.NewFileAWSCredentials(path.Join(homeDir, ".aws", "credentials"), "default")
|
s3Creds := credentials.NewFileAWSCredentials(path.Join(homeDir, ".aws", "credentials"), profile)
|
||||||
credVals, credErr := s3Creds.GetWithContext(&credentials.CredContext{Endpoint: host, Client: httpClient})
|
credVals, credErr := s3Creds.GetWithContext(&credentials.CredContext{Endpoint: host, Client: httpClient})
|
||||||
if credErr != nil {
|
if credErr != nil {
|
||||||
return nil, credErr
|
return nil, credErr
|
||||||
|
2
release
2
release
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eou pipefail
|
set -eou pipefail
|
||||||
go generate ./...
|
go generate ./...
|
||||||
export CURRENT_TAG="$(go run backy.go version -V)"
|
CURRENT_TAG="$(go run backy.go version -V)"
|
||||||
goreleaser -f .goreleaser/github.yml check
|
goreleaser -f .goreleaser/github.yml check
|
||||||
goreleaser -f .goreleaser/gitea.yml check
|
goreleaser -f .goreleaser/gitea.yml check
|
||||||
changie batch $CURRENT_TAG
|
changie batch $CURRENT_TAG
|
||||||
|
Loading…
x
Reference in New Issue
Block a user