mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-02 00:10:45 +02:00
Add an option to request certificate with Must-Staple. (#697)
This commit is contained in:
parent
8856577f39
commit
8fc1e9cca8
5 changed files with 92 additions and 23 deletions
|
@ -314,6 +314,35 @@ func Test_NewOptionsFromConfigEnvVar(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func Test_AutoCertOptionsFromEnvVar(t *testing.T) {
|
||||
envs := map[string]string{
|
||||
"AUTOCERT": "true",
|
||||
"AUTOCERT_DIR": "/test",
|
||||
"AUTOCERT_MUST_STAPLE": "true",
|
||||
|
||||
"INSECURE_SERVER": "true",
|
||||
}
|
||||
for k, v := range envs {
|
||||
os.Setenv(k, v)
|
||||
defer os.Unsetenv(k)
|
||||
}
|
||||
|
||||
o, err := NewOptionsFromConfig("")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !o.AutocertOptions.Enable {
|
||||
t.Error("o.AutocertOptions.Enable: want true, got false")
|
||||
}
|
||||
if !o.AutocertOptions.MustStaple {
|
||||
t.Error("o.AutocertOptions.MustStaple: want true, got false")
|
||||
}
|
||||
if o.AutocertOptions.Folder != "/test" {
|
||||
t.Errorf("o.AutocertOptions.Folder: want /test, got %s", o.AutocertOptions.Folder)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type mockService struct {
|
||||
fail bool
|
||||
Updated bool
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue