EnvVar
Fiber를 위한 EnvVar 미들웨어로, 다양한 옵션으로 환경 변수를 노출하는 데 사용할 수 있습니다.
Signatures
func New(config ...Config) fiber.Handler
Examples
Fiber 웹 프레임워크의 일부인 미들웨어 패키지를 가져옵니다.
import (
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/envvar"
)
Fiber 앱을 초기화한 후 다음과 같은 가능성을 사용할 수 있습니다:
// 기본 설정 초기화
app.Use("/expose/envvars", envvar.New())
// 또는 사용자 정의를 위해 설정 확장
app.Use("/expose/envvars", envvar.New(
envvar.Config{
ExportVars: map[string]string{"testKey": "", "testDefaultKey": "testDefaultVal"},
ExcludeVars: map[string]string{"excludeKey": ""},
}),
)
Response
Http 응답 계약:
{
"vars": {
"someEnvVariable": "someValue",
"anotherEnvVariable": "anotherValue"
}
}
Config
Property
Type
Description
Default
ExportVars
map[string]string
ExportVars는 내보내야 할 환경 변수를 지정합니다.
nil
ExcludeVars
map[string]string
ExcludeVars는 내보내지 말아야 할 환경 변수를 지정합니다.
nil
Default Config
Config{}
Last updated