Skip to content

Commit

Permalink
Moved the ENV varible to configuration_singleton
Browse files Browse the repository at this point in the history
  • Loading branch information
harshit-soora committed Feb 20, 2025
1 parent edd5c32 commit d520922
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
12 changes: 2 additions & 10 deletions apps/dashboard/app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ class Project
extend JobLogger

class << self
def shared_projects_paths
vendor_path = ENV['VENDOR_SHARED_FILESYSTEM'] || ''
[
Pathname.new('/fs/projects'),
Pathname.new('/fs/scratch'),
Pathname.new(vendor_path)
]
end

def lookup_file
Pathname("#{dataroot}/.project_lookup").tap do |path|
FileUtils.touch(path.to_s) unless path.exist?
Expand All @@ -41,7 +32,8 @@ def all
Project.new({ id: id, directory: directory })
end

shared_projects_paths.each do |path|
# TODO: Move this out of here
Configuration.shared_projects_root.each do |path|
if path.exist?
CurrentUser.group_names.each do |group|
dir_path = path.join(group)
Expand Down
16 changes: 16 additions & 0 deletions apps/dashboard/config/configuration_singleton.rb
Original file line number Diff line number Diff line change
Expand Up @@ -529,4 +529,20 @@ def add_string_configs
end
end
end

def shared_projects_root
# This environment varible will support ':' colon separated paths
vendor_path = ENV['VENDOR_SHARED_FILESYSTEM'] || ''
path_list = vendor_path.split(":")

paths = []
path_list.each do |path|
temp_path = Pathname.new(path)
if temp_path.exists?
paths.append(temp_path)
end
end

return paths
end
end

0 comments on commit d520922

Please sign in to comment.