mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-12-20 17:58:29 +00:00
Fix dev mode for yumrepofs
This commit is contained in:
parent
26ab9cbdb2
commit
8d2116dfeb
@ -60,7 +60,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func mn(_ *cobra.Command, _ []string) {
|
func mn(_ *cobra.Command, _ []string) {
|
||||||
sess, err := utils.NewAwsSession(&aws.Config{})
|
sess, err := utils.NewAwsSessionNoLocalStack(&aws.Config{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
11
utils/aws.go
11
utils/aws.go
@ -39,7 +39,7 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewAwsSession(cfg *aws.Config) (*session.Session, error) {
|
func awsConfigInternal(cfg *aws.Config) {
|
||||||
if accessKey := viper.GetString("s3-access-key"); accessKey != "" {
|
if accessKey := viper.GetString("s3-access-key"); accessKey != "" {
|
||||||
cfg.Credentials = credentials.NewStaticCredentials(accessKey, viper.GetString("s3-secret-key"), "")
|
cfg.Credentials = credentials.NewStaticCredentials(accessKey, viper.GetString("s3-secret-key"), "")
|
||||||
}
|
}
|
||||||
@ -63,7 +63,16 @@ func NewAwsSession(cfg *aws.Config) (*session.Session, error) {
|
|||||||
if os.Getenv("AWS_REGION") != "" {
|
if os.Getenv("AWS_REGION") != "" {
|
||||||
cfg.Region = aws.String(os.Getenv("AWS_REGION"))
|
cfg.Region = aws.String(os.Getenv("AWS_REGION"))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAwsSessionNoLocalStack(cfg *aws.Config) (*session.Session, error) {
|
||||||
|
awsConfigInternal(cfg)
|
||||||
|
|
||||||
|
return session.NewSession(cfg)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAwsSession(cfg *aws.Config) (*session.Session, error) {
|
||||||
|
awsConfigInternal(cfg)
|
||||||
if os.Getenv("LOCALSTACK_ENDPOINT") != "" && os.Getenv("RESF_ENV") == "dev" {
|
if os.Getenv("LOCALSTACK_ENDPOINT") != "" && os.Getenv("RESF_ENV") == "dev" {
|
||||||
cfg.Endpoint = aws.String(os.Getenv("LOCALSTACK_ENDPOINT"))
|
cfg.Endpoint = aws.String(os.Getenv("LOCALSTACK_ENDPOINT"))
|
||||||
cfg.Credentials = credentials.NewStaticCredentials("test", "test", "")
|
cfg.Credentials = credentials.NewStaticCredentials("test", "test", "")
|
||||||
|
Loading…
Reference in New Issue
Block a user