-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into embed_contracts
- Loading branch information
Showing
11 changed files
with
208 additions
and
162 deletions.
There are no files selected for viewing
File renamed without changes.
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
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,34 @@ | ||
package config | ||
|
||
type AppOption struct { | ||
DisableCLIParse bool | ||
IsStaked bool | ||
Bootnodes []string | ||
RandomIdentity bool | ||
} | ||
|
||
type Option func(*AppOption) | ||
|
||
var DisableCLIParse = func(o *AppOption) { | ||
o.DisableCLIParse = true | ||
} | ||
|
||
var EnableStaked = func(o *AppOption) { | ||
o.IsStaked = true | ||
} | ||
|
||
var EnableRandomIdentity = func(o *AppOption) { | ||
o.RandomIdentity = true | ||
} | ||
|
||
func (a *AppOption) Apply(opts ...Option) { | ||
for _, opt := range opts { | ||
opt(a) | ||
} | ||
} | ||
|
||
func WithBootNodes(bootnodes ...string) Option { | ||
return func(o *AppOption) { | ||
o.Bootnodes = append(o.Bootnodes, bootnodes...) | ||
} | ||
} |
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
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
Oops, something went wrong.