mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
b4437e6cec
* Pass graffati file and use it * Visibility * Parse test * More proposal tests * Gazelle * Add sequential functionality * fix length check * Update priorities. Specified -> random -> default * Log warn instead return err * Comment * E2e test * Comment Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
27 lines
572 B
Go
27 lines
572 B
Go
package graffiti
|
|
|
|
import (
|
|
"io/ioutil"
|
|
|
|
"gopkg.in/yaml.v2"
|
|
)
|
|
|
|
type Graffiti struct {
|
|
Default string `yaml:"default,omitempty"`
|
|
Random []string `yaml:"random,omitempty"`
|
|
Specific map[uint64]string `yaml:"specific,omitempty"`
|
|
}
|
|
|
|
// ParseGraffitiFile parses the graffiti file and returns the graffiti struct.
|
|
func ParseGraffitiFile(f string) (*Graffiti, error) {
|
|
yamlFile, err := ioutil.ReadFile(f)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
g := &Graffiti{}
|
|
if err := yaml.Unmarshal(yamlFile, g); err != nil {
|
|
return nil, err
|
|
}
|
|
return g, nil
|
|
}
|