Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Dotenv
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanoverna committed Dec 17, 2016
1 parent db485c9 commit a78102e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 8 additions & 1 deletion lib/middleman_dato/middleman_extension.rb
Expand Up @@ -7,6 +7,7 @@
require 'middleman_dato/watcher'
require 'dato/utils/seo_tags_builder'
require 'dato/utils/favicon_tags_builder'
require 'dotenv'

module MiddlemanDato
class MiddlemanExtension < ::Middleman::Extension
Expand Down Expand Up @@ -42,8 +43,14 @@ def initialize(app, options_hash = {}, &block)
end

def client
token = options[:token]

if token.blank? && File.exist?('.env')
Dotenv::Environment.new('.env')['DATO_API_TOKEN']
end

@client ||= Dato::Site::Client.new(
options[:token],
token,
base_url: options[:api_base_url],
extra_headers: {
'X-Reason' => 'dump',
Expand Down
2 changes: 1 addition & 1 deletion lib/middleman_dato/version.rb
@@ -1,4 +1,4 @@
# frozen_string_literal: true
module MiddlemanDato
VERSION = '0.7.0'
VERSION = '0.7.1'
end
8 changes: 4 additions & 4 deletions middleman-dato.gemspec
Expand Up @@ -22,8 +22,8 @@ Gem::Specification.new do |s|

s.add_development_dependency('coveralls')

s.add_runtime_dependency('middleman-core', ['>= 4.1.10'])
s.add_runtime_dependency('dato', ['>= 0.3.0'])
s.add_runtime_dependency('activesupport')
s.add_runtime_dependency('pusher-client')
s.add_runtime_dependency 'middleman-core', ['>= 4.1.10']
s.add_runtime_dependency 'dato', ['>= 0.3.2']
s.add_runtime_dependency 'activesupport'
s.add_runtime_dependency 'dotenv'
end

0 comments on commit a78102e

Please sign in to comment.