Skip to content

Commit

Permalink
Recompile configs and presets on file change
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaRedHand committed Jan 16, 2024
1 parent 445154b commit aa5d639
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion lib/chain_spec/configs/mainnet.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ defmodule MainnetConfig do
@moduledoc """
Mainnet config constants.
"""
file = "config/networks/mainnet/config.yaml"

@parsed_config ConfigUtils.load_config_from_file!("config/networks/mainnet/config.yaml")
@external_resource file

@parsed_config ConfigUtils.load_config_from_file!(file)
@unified Map.merge(MainnetPreset.get_preset(), @parsed_config)

def get(key), do: Map.fetch!(@unified, key)
Expand Down
5 changes: 4 additions & 1 deletion lib/chain_spec/configs/minimal.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ defmodule MinimalConfig do
@moduledoc """
Minimal config constants.
"""
file = "config/networks/minimal/config.yaml"

@parsed_config ConfigUtils.load_config_from_file!("config/networks/minimal/config.yaml")
@external_resource file

@parsed_config ConfigUtils.load_config_from_file!(file)
@unified Map.merge(MinimalPreset.get_preset(), @parsed_config)

def get(key), do: Map.fetch!(@unified, key)
Expand Down
5 changes: 4 additions & 1 deletion lib/chain_spec/configs/sepolia.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ defmodule SepoliaConfig do
@moduledoc """
Sepolia config constants.
"""
file = "config/networks/sepolia/config.yaml"

@parsed_config ConfigUtils.load_config_from_file!("config/networks/sepolia/config.yaml")
@external_resource file

@parsed_config ConfigUtils.load_config_from_file!(file)
@unified Map.merge(MainnetPreset.get_preset(), @parsed_config)

def get(key), do: Map.fetch!(@unified, key)
Expand Down
5 changes: 4 additions & 1 deletion lib/chain_spec/presets/mainnet.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ defmodule MainnetPreset do
Mainnet preset constants.
"""

@parsed_preset ConfigUtils.load_preset_from_dir!("config/presets/mainnet")
file = "config/presets/mainnet"
@external_resource file

@parsed_preset ConfigUtils.load_preset_from_dir!(file)

def get_preset, do: @parsed_preset
end
5 changes: 4 additions & 1 deletion lib/chain_spec/presets/minimal.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ defmodule MinimalPreset do
Minimal preset constants.
"""

@parsed_preset ConfigUtils.load_preset_from_dir!("config/presets/minimal")
file = "config/presets/minimal"
@external_resource file

@parsed_preset ConfigUtils.load_preset_from_dir!(file)

def get_preset, do: @parsed_preset
end

0 comments on commit aa5d639

Please sign in to comment.