Module: Dotenv

Defined in:
lib/dotenv-schema.rb,
lib/dotenv/schema.rb,
lib/dotenv-schema/version.rb

Defined Under Namespace

Classes: Schema

Constant Summary collapse

SCHEMA_VERSION =
'0.0.1'

Class Method Summary collapse

Class Method Details

.load_with_validation(*filenames) ⇒ Object Also known as: load



6
7
8
9
10
11
12
13
# File 'lib/dotenv-schema.rb', line 6

def load_with_validation(*filenames)
  env_before = ENV.to_hash
  load_without_validation *filenames
  env = ENV.to_hash.reject {|k, v| env_before.has_key?(k) }

  schema = Schema.load schema_path
  schema.validate! env
end

.schema_pathObject



21
22
23
# File 'lib/dotenv-schema.rb', line 21

def schema_path
  @schema_path || '.env_schema'
end

.schema_path=(path) ⇒ Object



17
18
19
# File 'lib/dotenv-schema.rb', line 17

def schema_path=(path)
  @schema_path = path
end