28 lines
587 B
Go
28 lines
587 B
Go
|
package http
|
||
|
|
||
|
type LocalHandlerOptions struct {
|
||
|
RoutePrefix string
|
||
|
Accounts []LocalAccount
|
||
|
}
|
||
|
|
||
|
type LocalHandlerOptionFunc func(*LocalHandlerOptions)
|
||
|
|
||
|
func defaultLocalHandlerOptions() *LocalHandlerOptions {
|
||
|
return &LocalHandlerOptions{
|
||
|
RoutePrefix: "",
|
||
|
Accounts: make([]LocalAccount, 0),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func WithAccounts(accounts ...LocalAccount) LocalHandlerOptionFunc {
|
||
|
return func(opts *LocalHandlerOptions) {
|
||
|
opts.Accounts = accounts
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func WithRoutePrefix(prefix string) LocalHandlerOptionFunc {
|
||
|
return func(opts *LocalHandlerOptions) {
|
||
|
opts.RoutePrefix = prefix
|
||
|
}
|
||
|
}
|