-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: WS-279 fixed issue where environment variables were not bein…
…g interpolated into spec
- Loading branch information
1 parent
3f99f60
commit 1b00b53
Showing
3 changed files
with
934 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package rest_test | ||
|
||
import ( | ||
"github.com/wepala/weos/v2/rest" | ||
"os" | ||
"testing" | ||
) | ||
|
||
func TestConfig(t *testing.T) { | ||
os.Setenv("WEOS_SPEC", "./fixtures/api_with_environment_variables.yaml") | ||
os.Setenv("DB_DRIVER", "sqlite3") | ||
os.Setenv("BASE_PATH", "/local") | ||
spec, err := rest.Config() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
if spec == nil { | ||
t.Fatal("spec is nil") | ||
} | ||
if data, ok := spec.Extensions[rest.WeOSConfigExtension]; ok { | ||
if basePath, ok := data.(map[string]interface{})["basePath"]; ok { | ||
if basePath != "/local" { | ||
t.Errorf("expected basePath to be /local but got %s", basePath) | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.