* ci: bump golangci/golangci-lint-action from 6 to 7 Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v6...v7) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * fix lint Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix v2 Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix v3 Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Jens Langhammer <jens@goauthentik.io> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jens Langhammer <jens@goauthentik.io>
		
			
				
	
	
		
			51 lines
		
	
	
		
			1023 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1023 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package config
 | 
						|
 | 
						|
import (
 | 
						|
	"fmt"
 | 
						|
	"log"
 | 
						|
	"os"
 | 
						|
	"testing"
 | 
						|
 | 
						|
	"github.com/stretchr/testify/assert"
 | 
						|
)
 | 
						|
 | 
						|
func TestConfigEnv(t *testing.T) {
 | 
						|
	assert.NoError(t, os.Setenv("AUTHENTIK_SECRET_KEY", "bar"))
 | 
						|
	cfg = nil
 | 
						|
	if err := Get().fromEnv(); err != nil {
 | 
						|
		panic(err)
 | 
						|
	}
 | 
						|
	assert.Equal(t, "bar", Get().SecretKey)
 | 
						|
}
 | 
						|
 | 
						|
func TestConfigEnv_Scheme(t *testing.T) {
 | 
						|
	assert.NoError(t, os.Setenv("foo", "bar"))
 | 
						|
	assert.NoError(t, os.Setenv("AUTHENTIK_SECRET_KEY", "env://foo"))
 | 
						|
	cfg = nil
 | 
						|
	if err := Get().fromEnv(); err != nil {
 | 
						|
		panic(err)
 | 
						|
	}
 | 
						|
	assert.Equal(t, "bar", Get().SecretKey)
 | 
						|
}
 | 
						|
 | 
						|
func TestConfigEnv_File(t *testing.T) {
 | 
						|
	file, err := os.CreateTemp("", "")
 | 
						|
	if err != nil {
 | 
						|
		log.Fatal(err)
 | 
						|
	}
 | 
						|
	defer func() {
 | 
						|
		assert.NoError(t, os.Remove(file.Name()))
 | 
						|
	}()
 | 
						|
	_, err = file.Write([]byte("bar"))
 | 
						|
	if err != nil {
 | 
						|
		panic(err)
 | 
						|
	}
 | 
						|
 | 
						|
	assert.NoError(t, os.Setenv("AUTHENTIK_SECRET_KEY", fmt.Sprintf("file://%s", file.Name())))
 | 
						|
	cfg = nil
 | 
						|
	if err := Get().fromEnv(); err != nil {
 | 
						|
		panic(err)
 | 
						|
	}
 | 
						|
	assert.Equal(t, "bar", Get().SecretKey)
 | 
						|
}
 |