Fix create of 'datadir', 'tmpdir'
This commit is contained in:
parent
4cbd4d6f39
commit
9bbc067ff0
2 changed files with 8 additions and 9 deletions
|
@ -4,13 +4,12 @@ module Twenty
|
|||
require "fileutils"
|
||||
require "sequel"
|
||||
require_relative "twenty-server/path"
|
||||
extend Path
|
||||
|
||||
##
|
||||
# @return [String]
|
||||
# Returns the location of the default SQLite database.
|
||||
def self.default_database
|
||||
@default_database ||= File.join(datadir, "database.sqlite")
|
||||
@default_database ||= File.join(Path.datadir, "database.sqlite")
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -32,13 +31,7 @@ module Twenty
|
|||
@connection
|
||||
end
|
||||
|
||||
begin
|
||||
FileUtils.mkdir_p(datadir)
|
||||
FileUtils.mkdir_p(tmpdir)
|
||||
FileUtils.touch(default_database)
|
||||
rescue => ex
|
||||
warn "prepare_dir error: #{ex.message} (#{ex.class})"
|
||||
end
|
||||
FileUtils.touch(default_database)
|
||||
require_relative "twenty-server/graphql"
|
||||
require_relative "twenty-server/rack"
|
||||
end
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Twenty::Path
|
||||
require "tmpdir"
|
||||
extend self
|
||||
|
||||
##
|
||||
# @return [String]
|
||||
# Returns the directory where twenty stores persistent data.
|
||||
|
@ -22,4 +25,7 @@ module Twenty::Path
|
|||
def pidfile
|
||||
File.join(tmpdir, "server.pid")
|
||||
end
|
||||
|
||||
FileUtils.mkdir_p(datadir)
|
||||
FileUtils.mkdir_p(tmpdir)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue