Read secrets from variable path

This change enables secrets to be read from any mount on disk
rather than hard-coding a certain location which suits Swarm or
K8s. The default value if not specified will look in the Swarm
location of /run/secrets/

README.md (docs) updated and set to off by default.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (VMware)
2018-05-22 14:46:29 +01:00
committed by Alex Ellis
parent a38931ce69
commit 8133414183
9 changed files with 91 additions and 25 deletions

View File

@ -5,6 +5,8 @@ import (
"net/http"
"net/http/httptest"
"testing"
"github.com/openfaas/faas/gateway/types"
)
func Test_AuthWithValidPassword_Gives200(t *testing.T) {
@ -18,7 +20,7 @@ func Test_AuthWithValidPassword_Gives200(t *testing.T) {
wantPassword := "password"
r := httptest.NewRequest(http.MethodGet, "http://localhost:8080", nil)
r.SetBasicAuth(wantUser, wantPassword)
wantCredentials := &BasicAuthCredentials{
wantCredentials := &types.BasicAuthCredentials{
User: wantUser,
Password: wantPassword,
}
@ -47,7 +49,7 @@ func Test_AuthWithInvalidPassword_Gives403(t *testing.T) {
r := httptest.NewRequest(http.MethodGet, "http://localhost:8080", nil)
r.SetBasicAuth(wantUser, wantPassword)
wantCredentials := &BasicAuthCredentials{
wantCredentials := &types.BasicAuthCredentials{
User: wantUser,
Password: "",
}