Commit 6800f567 authored by Łukasz Magiera's avatar Łukasz Magiera

coreapi: FetchBlocks option

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent 360e8bbf
package options
type ApiSettings struct {
Offline bool
Offline bool
FetchBlocks bool
}
type ApiOption func(*ApiSettings) error
func ApiOptions(opts ...ApiOption) (*ApiSettings, error) {
options := &ApiSettings{
Offline: false,
Offline: false,
FetchBlocks: true,
}
return ApiOptionsTo(options, opts...)
......@@ -34,3 +36,12 @@ func (apiOpts) Offline(offline bool) ApiOption {
return nil
}
}
// FetchBlocks when set to false prevents api from fetching blocks from the
// network while allowing other services such as IPNS to still be online
func (apiOpts) FetchBlocks(fetch bool) ApiOption {
return func(settings *ApiSettings) error {
settings.FetchBlocks = fetch
return nil
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment