Skip to content

Commit

Permalink
use provided config file for beacon store (#1180)
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden authored Apr 16, 2024
1 parent 0d7c853 commit 76258e5
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions relayer/cmd/store_beacon_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,8 @@ func storeBeaconState() *cobra.Command {
RunE: storeBeaconStateInDB,
}

cmd.Flags().String("url", "", "URL to generate test fixtures from")
err := cmd.MarkFlagRequired("url")
if err != nil {
return nil
}

cmd.Flags().String("db-store-location", "", "where the database store file should be stored")
err = cmd.MarkFlagRequired("db-store-location")
cmd.Flags().String("config", "", "path to the beacon config file to use")
err := cmd.MarkFlagRequired("config")
if err != nil {
return nil
}
Expand All @@ -40,17 +34,12 @@ func storeBeaconState() *cobra.Command {
}

func storeBeaconStateInDB(cmd *cobra.Command, _ []string) error {
dbStoreLocation, err := cmd.Flags().GetString("db-store-location")
if err != nil {
return err
}

url, err := cmd.Flags().GetString("url")
configFile, err := cmd.Flags().GetString("config")
if err != nil {
return err
}

viper.SetConfigFile("web/packages/test/config/beacon-relay.json")
viper.SetConfigFile(configFile)
if err := viper.ReadInConfig(); err != nil {
return err
}
Expand All @@ -60,10 +49,10 @@ func storeBeaconStateInDB(cmd *cobra.Command, _ []string) error {
return err
}

store := store.New(dbStoreLocation, 100)
store := store.New(conf.Source.Beacon.DataStore.Location, conf.Source.Beacon.DataStore.MaxEntries)

specSettings := conf.Source.Beacon.Spec
beaconClient := api.NewBeaconClient(url, specSettings.SlotsInEpoch)
beaconClient := api.NewBeaconClient(conf.Source.Beacon.Endpoint, specSettings.SlotsInEpoch)
syncer := syncer.New(beaconClient, specSettings, &store)

err = store.Connect()
Expand Down

0 comments on commit 76258e5

Please sign in to comment.