Add support for dotenv

This commit is contained in:
Thomas Reynolds 2016-05-25 10:54:49 -07:00
parent 38a9025560
commit 6440d53e7a
3 changed files with 7 additions and 1 deletions

View file

@ -9,6 +9,9 @@ end
require "middleman-core/load_paths" require "middleman-core/load_paths"
Middleman.setup_load_paths Middleman.setup_load_paths
require 'dotenv'
::Dotenv.load
require 'middleman-core' require 'middleman-core'
require 'middleman-core/logger' require 'middleman-core/logger'
@ -46,6 +49,8 @@ end
::Middleman::Logger.singleton(3) ::Middleman::Logger.singleton(3)
::Middleman::Cli.config = ::Middleman::Application.new do ::Middleman::Cli.config = ::Middleman::Application.new do
#
config[:environment] = (ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development').to_sym
config[:mode] = :config config[:mode] = :config
config[:exit_before_ready] = true config[:exit_before_ready] = true
config[:watcher_disable] = true config[:watcher_disable] = true

View file

@ -10,7 +10,7 @@ module Middleman::Cli
class_option :environment, class_option :environment,
aliases: '-e', aliases: '-e',
default: :production default: ENV['MM_ENV'] || ENV['RACK_ENV'] || :production
class_option :clean, class_option :clean,
type: :boolean, type: :boolean,
default: true, default: true,

View file

@ -26,6 +26,7 @@ Gem::Specification.new do |s|
s.add_dependency('fast_blank') s.add_dependency('fast_blank')
s.add_dependency('parallel') s.add_dependency('parallel')
s.add_dependency('servolux') s.add_dependency('servolux')
s.add_dependency('dotenv')
# Helpers # Helpers
s.add_dependency('activesupport', ['~> 4.2']) s.add_dependency('activesupport', ['~> 4.2'])