Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zhulik committed Jan 3, 2023
1 parent a4f3a20 commit f110171
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions lib/dotcrypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,30 @@
loader.setup

module Dotcrypt
end
DEFAULT_NAME = ".env.dhall"

class Error < StandardError
end

def self.setup(path: find_dotcrypt)
Dotcrypt::Dhall.load_from(path).then do |c|
Dotcrypt::Flattener.call(c).then do |f|
ENV.merge!(f)
return f
end
end
end

def self.find_dotcrypt
dir = Dir.getwd
loop do
raise ".env.dhall is noot found" if dir == "/"

path = File.join(dir, DEFAULT_NAME)

return path if File.exist?(path)

class Dotcrypt::Error < StandardError
# Your code goes here...
dir = File.expand_path("..", dir)
end
end
end

0 comments on commit f110171

Please sign in to comment.