initial commit
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package app
|
||||
|
||||
type Option func(*App)
|
||||
|
||||
func WithHTTPAddr(addr string) Option {
|
||||
return func(a *App) {
|
||||
a.config.httpAddr = addr
|
||||
}
|
||||
}
|
||||
|
||||
func WithGRPCAddr(addr string) Option {
|
||||
return func(a *App) {
|
||||
a.config.grpcAddr = addr
|
||||
}
|
||||
}
|
||||
|
||||
func WithPostgresDatabase(uri string) Option {
|
||||
return func(a *App) {
|
||||
a.config.postgresURI = uri
|
||||
}
|
||||
}
|
||||
|
||||
func WithMongoDatabase(uri string) Option {
|
||||
return func(a *App) {
|
||||
a.config.mongoURI = uri
|
||||
}
|
||||
}
|
||||
|
||||
func WithSwaggerUI() Option {
|
||||
return func(a *App) {
|
||||
a.config.withSwagger = true
|
||||
}
|
||||
}
|
||||
|
||||
func WithStatic() Option {
|
||||
return func(a *App) {
|
||||
a.config.withStatic = true
|
||||
}
|
||||
}
|
||||
|
||||
func WithForwardResponse(fn forwardResponseFunc) Option {
|
||||
return func(a *App) {
|
||||
a.config.forwardResponse = fn
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user