View Source Runbox.Scenario.Config (runbox v13.0.3)

Provides configuration to a scenario.

Summary

Functions

Read file from the config dir.

Resolves a path to a file in scenario config.

Functions

Link to this function

read_file(scenario_id, file_path)

View Source
@spec read_file(String.t() | atom(), String.t()) ::
  {:ok, binary()} | {:error, File.posix()}

Read file from the config dir.

The file is located in the configuration directory, in a folder matching the scenario_id param. The file is read if it exists and content is returned as {:ok, content}, otherwise {:error, reason} is returned.

Link to this function

resolve_file(scenario_id, file_path)

View Source
@spec resolve_file(String.t() | atom(), String.t()) :: String.t()

Resolves a path to a file in scenario config.

The file is located in the configuration directory, in a folder matching the scenario_id param. This function resolves the path so that it can be used with File functions directly. The existence of the file is not verified. Note if you want to just read the file, you can use read_file/2, this function should be used when you need to handle the file in a special manner (e.g. streaming).