move default base url to method to deal with deployment issues
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
class StorageManager
|
class StorageManager
|
||||||
class Error < StandardError; end
|
class Error < StandardError; end
|
||||||
|
|
||||||
DEFAULT_BASE_URL = Rails.application.routes.url_helpers.root_url + "data"
|
|
||||||
DEFAULT_BASE_DIR = "#{Rails.root}/public/data"
|
DEFAULT_BASE_DIR = "#{Rails.root}/public/data"
|
||||||
|
|
||||||
attr_reader :base_url, :base_dir, :hierarchical, :tagged_filenames, :large_image_prefix
|
attr_reader :base_url, :base_dir, :hierarchical, :tagged_filenames, :large_image_prefix
|
||||||
|
|
||||||
def initialize(base_url: DEFAULT_BASE_URL, base_dir: DEFAULT_BASE_DIR, hierarchical: false, tagged_filenames: Danbooru.config.enable_seo_post_urls, large_image_prefix: Danbooru.config.large_image_prefix)
|
def initialize(base_url: default_base_url, base_dir: DEFAULT_BASE_DIR, hierarchical: false, tagged_filenames: Danbooru.config.enable_seo_post_urls, large_image_prefix: Danbooru.config.large_image_prefix)
|
||||||
@base_url = base_url.chomp("/")
|
@base_url = base_url.chomp("/")
|
||||||
@base_dir = base_dir
|
@base_dir = base_dir
|
||||||
@hierarchical = hierarchical
|
@hierarchical = hierarchical
|
||||||
@@ -14,6 +13,10 @@ class StorageManager
|
|||||||
@large_image_prefix = large_image_prefix
|
@large_image_prefix = large_image_prefix
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def default_base_url
|
||||||
|
Rails.application.routes.url_helpers.root_url + "data"
|
||||||
|
end
|
||||||
|
|
||||||
# Store the given file at the given path. If a file already exists at that
|
# Store the given file at the given path. If a file already exists at that
|
||||||
# location it should be overwritten atomically. Either the file is fully
|
# location it should be overwritten atomically. Either the file is fully
|
||||||
# written, or an error is raised and the original file is left unchanged. The
|
# written, or an error is raised and the original file is left unchanged. The
|
||||||
|
|||||||
Reference in New Issue
Block a user