balder ENV settings. s3 init. remove settings.yml
This commit is contained in:
parent
927918561c
commit
5cf109280b
|
@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_public_access
|
def check_public_access
|
||||||
require_user unless APP_CONFIG[:public]
|
require_user unless ENV['public'] == 'true'
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_user_session
|
def current_user_session
|
||||||
|
|
|
@ -92,13 +92,13 @@ class Album < ActiveRecord::Base
|
||||||
private
|
private
|
||||||
|
|
||||||
def create_folders
|
def create_folders
|
||||||
Dir.mkdir( APP_CONFIG[:photos_path] + self.path ) unless File.exists?( APP_CONFIG[:photos_path] + self.path )
|
#Dir.mkdir( APP_CONFIG[:photos_path] + self.path ) unless File.exists?( APP_CONFIG[:photos_path] + self.path )
|
||||||
Dir.mkdir( APP_CONFIG[:thumbs_path] + self.path ) unless File.exists?( APP_CONFIG[:thumbs_path] + self.path )
|
#Dir.mkdir( APP_CONFIG[:thumbs_path] + self.path ) unless File.exists?( APP_CONFIG[:thumbs_path] + self.path )
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy_folders
|
def destroy_folders
|
||||||
#puts "DELETE DIRECTORY " + APP_CONFIG[:photos_path] + self.path
|
#puts "DELETE DIRECTORY " + APP_CONFIG[:photos_path] + self.path
|
||||||
Dir.delete( APP_CONFIG[:photos_path] + self.path ) if File.exists?( APP_CONFIG[:photos_path] + self.path )
|
#Dir.delete( APP_CONFIG[:photos_path] + self.path ) if File.exists?( APP_CONFIG[:photos_path] + self.path )
|
||||||
Dir.delete( APP_CONFIG[:thumbs_path] + self.path ) if File.exists?( APP_CONFIG[:thumbs_path] + self.path )
|
#Dir.delete( APP_CONFIG[:thumbs_path] + self.path ) if File.exists?( APP_CONFIG[:thumbs_path] + self.path )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,8 +8,11 @@ class FileUploader < CarrierWave::Uploader::Base
|
||||||
|
|
||||||
# Choose what kind of storage to use for this uploader
|
# Choose what kind of storage to use for this uploader
|
||||||
#storage :file
|
#storage :file
|
||||||
storage :s3
|
if ENV['S3_KEY']
|
||||||
|
storage :s3
|
||||||
|
else
|
||||||
|
storage :file
|
||||||
|
end
|
||||||
|
|
||||||
# Override the directory where uploaded files will be stored
|
# Override the directory where uploaded files will be stored
|
||||||
# This is a sensible default for uploaders that are meant to be mounted:
|
# This is a sensible default for uploaders that are meant to be mounted:
|
||||||
|
|
|
@ -27,7 +27,4 @@
|
||||||
<%= form.text_field :tags, { :autocomplete => "off", :class => 'tag_list', :value => (@album.tags.map{|tag|tag.title}.join(" ") unless @album.tags.nil?) } %><br />
|
<%= form.text_field :tags, { :autocomplete => "off", :class => 'tag_list', :value => (@album.tags.map{|tag|tag.title}.join(" ") unless @album.tags.nil?) } %><br />
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<% if @album.path? %>
|
|
||||||
Location on disk: <i><%= APP_CONFIG[:photos_path] + @album.path %></i><br/>
|
|
||||||
Contains: <%= @album.photos.count %> photos<br/>
|
Contains: <%= @album.photos.count %> photos<br/>
|
||||||
<% end %>
|
|
|
@ -3,7 +3,7 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title><%= APP_CONFIG[:site_name] %></title>
|
<title><%= ENV['site_name'] %></title>
|
||||||
<%= yield :head %>
|
<%= yield :head %>
|
||||||
<%= stylesheet_link_tag 'application' %>
|
<%= stylesheet_link_tag 'application' %>
|
||||||
</head>
|
</head>
|
||||||
|
@ -22,10 +22,10 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<h1>
|
<h1>
|
||||||
<% if APP_CONFIG[:site_logo] %>
|
<% if ENV['LOGO'] %>
|
||||||
<%= image_tag APP_CONFIG[:site_logo] %>
|
<%= image_tag ENV['LOGO'] %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= APP_CONFIG[:site_name] %>
|
<%= ENV['TITLE'] %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</h1>
|
</h1>
|
||||||
<form action="/albums" method="get" id="search">
|
<form action="/albums" method="get" id="search">
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
# Bootstrap the Rails environment, frameworks, and default configuration
|
# Bootstrap the Rails environment, frameworks, and default configuration
|
||||||
require File.join(File.dirname(__FILE__), 'boot')
|
require File.join(File.dirname(__FILE__), 'boot')
|
||||||
|
|
||||||
|
# Load heroku vars from local file
|
||||||
|
balder_env = File.join(RAILS_ROOT, 'config', 'balder.rb')
|
||||||
|
load(balder_env) if File.exists?(balder_env)
|
||||||
|
|
||||||
|
|
||||||
Rails::Initializer.run do |config|
|
Rails::Initializer.run do |config|
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#APP_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/settings.yml")[RAILS_ENV].symbolize_keys
|
|
||||||
APP_CONFIG = YAML.load(ERB.new(File.read("#{RAILS_ROOT}/config/settings.yml")).result)[RAILS_ENV].symbolize_keys
|
|
|
@ -1,5 +1,5 @@
|
||||||
CarrierWave.configure do |config|
|
CarrierWave.configure do |config|
|
||||||
config.s3_access_key_id = APP_CONFIG[:s3_access_key_id]
|
config.s3_access_key_id = ENV['S3_KEY']
|
||||||
config.s3_secret_access_key = APP_CONFIG[:s3_secret_access_key]
|
config.s3_secret_access_key = ENV['S3_SECRET']
|
||||||
config.s3_bucket = APP_CONFIG[:s3_bucket]
|
config.s3_bucket = ENV['S3_BUCKET']
|
||||||
end
|
end
|
|
@ -1,13 +0,0 @@
|
||||||
development:
|
|
||||||
public: true
|
|
||||||
site_name: 'Photos'
|
|
||||||
#site_logo: 'logo.png'
|
|
||||||
#s3_access_key_id: ''
|
|
||||||
#s3_secret_access_key: ''
|
|
||||||
#s3_bucket: ''
|
|
||||||
production:
|
|
||||||
public: true
|
|
||||||
site_name: 'Photos'
|
|
||||||
test:
|
|
||||||
public: true
|
|
||||||
site_name: 'Photos'
|
|
Loading…
Reference in a new issue