Module: Hanami::CLI::Commands::App::Command::Environment Private

Defined in:
lib/hanami/cli/commands/app/command.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Overloads #call to ensure an appropriate HANAMI_ENV environment variable is set.

Uses an --env option if provided, then falls back to an already-set HANAMI_ENV environment variable, and defaults to "development" in the absence of both.

Since:

  • 2.0.0

Instance Method Summary collapse

Instance Method Details

#call(*args, **opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



32
33
34
35
36
37
38
39
40
41
# File 'lib/hanami/cli/commands/app/command.rb', line 32

def call(*args, **opts)
  env = opts[:env]

  hanami_env = env ? env.to_s : ENV.fetch("HANAMI_ENV", "development")

  ENV["HANAMI_ENV"] = hanami_env
  Hanami::Env.load

  super(*args, **opts)
end