src/server/pkg/obj/obj.go
func NewAmazonClientFromEnv() (Client, error) {
	region, ok := os.LookupEnv(AmazonRegionEnvVar)
	if !ok {
		return nil, fmt.Errorf("%s not found", AmazonRegionEnvVar)
	}
	bucket, ok := os.LookupEnv(AmazonBucketEnvVar)
	if !ok {
		return nil, fmt.Errorf("%s not found", AmazonBucketEnvVar)
	}

	var creds AmazonCreds
	creds.ID, _ = os.LookupEnv(AmazonIDEnvVar)
	creds.Secret, _ = os.LookupEnv(AmazonSecretEnvVar)
	creds.Token, _ = os.LookupEnv(AmazonTokenEnvVar)
	creds.VaultAddress, _ = os.LookupEnv(AmazonVaultAddrEnvVar)
	creds.VaultRole, _ = os.LookupEnv(AmazonVaultRoleEnvVar)
	creds.VaultToken, _ = os.LookupEnv(AmazonVaultTokenEnvVar)

	distribution, _ := os.LookupEnv(AmazonDistributionEnvVar)
	return NewAmazonClient(region, bucket, &creds, distribution)
}
func NewAmazonClientFromEnv() (Client, error) {
	region, ok := os.LookupEnv(AmazonRegionEnvVar)
	if !ok {
		return nil, fmt.Errorf("%s not found", AmazonRegionEnvVar)
	}
	bucket, ok := os.LookupEnv(AmazonBucketEnvVar)
	if !ok {
		return nil, fmt.Errorf("%s not found", AmazonBucketEnvVar)
	}

	var creds AmazonCreds
	creds.ID, _ = os.LookupEnv(AmazonIDEnvVar)
	creds.Secret, _ = os.LookupEnv(AmazonSecretEnvVar)
	creds.Token, _ = os.LookupEnv(AmazonTokenEnvVar)
	creds.VaultAddress, _ = os.LookupEnv(AmazonVaultAddrEnvVar)
	creds.VaultRole, _ = os.LookupEnv(AmazonVaultRoleEnvVar)
	creds.VaultToken, _ = os.LookupEnv(AmazonVaultTokenEnvVar)

	distribution, _ := os.LookupEnv(AmazonDistributionEnvVar)
	return NewAmazonClient(region, bucket, &creds, distribution)
}
func NewAmazonClientFromEnv ( ) ( Client , error ) { region , ok := os . LookupEnv ( AmazonRegionEnvVar ) if ! ok { return nil , fmt . Errorf ( " " , AmazonRegionEnvVar ) } bucket , ok := os . LookupEnv ( AmazonBucketEnvVar ) if ! ok { return nil , fmt . Errorf ( " " , AmazonBucketEnvVar ) } var creds AmazonCreds creds . ID , _ = os . LookupEnv ( AmazonIDEnvVar ) creds . Secret , _ = os . LookupEnv ( AmazonSecretEnvVar ) creds . Token , _ = os . LookupEnv ( AmazonTokenEnvVar ) creds . VaultAddress , _ = os . LookupEnv ( AmazonVaultAddrEnvVar ) creds . VaultRole , _ = os . LookupEnv ( AmazonVaultRoleEnvVar ) creds . VaultToken , _ = os . LookupEnv ( AmazonVaultTokenEnvVar ) distribution , _ := os . LookupEnv ( AmazonDistributionEnvVar ) return NewAmazonClient ( region , bucket , & creds , distribution ) }
// NewAmazonClientFromEnv creates a Amazon client based on environment variables.
NewAmazonClientFromEnv creates a Amazon client based on environment variables .