Class: Appydave::Tools::Dam::ConfigLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/appydave/tools/dam/config_loader.rb

Overview

Configuration loader for video asset tools Loads settings from .video-tools.env file in the repository root

Usage:

config = ConfigLoader.load_from_repo(repo_path)
ssd_base = config['SSD_BASE']

Defined Under Namespace

Classes: ConfigNotFoundError, InvalidConfigError

Constant Summary collapse

CONFIG_FILENAME =
'.video-tools.env'
REQUIRED_KEYS =
%w[SSD_BASE].freeze

Class Method Summary collapse

Class Method Details

.load_from_repo(repo_path) ⇒ Hash

Load configuration from a repository path

Parameters:

  • repo_path (String)

    Path to the video project repository

Returns:

  • (Hash)

    Configuration hash



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/appydave/tools/dam/config_loader.rb', line 23

def load_from_repo(repo_path)
  config_path = File.join(repo_path, CONFIG_FILENAME)

  unless File.exist?(config_path)
    raise ConfigNotFoundError, "      \u274C Configuration file not found: \#{config_path}\n\n      Create a .video-tools.env file in your repository root with:\n\n      SSD_BASE=/Volumes/T7/youtube-PUBLISHED/appydave\n\n      See .env.example for a full template.\n    ERROR\n  end\n\n  config = parse_env_file(config_path)\n  validate_config!(config)\n  config\nend\n"