Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ ruby '>= 3.1.0'

gem 'rake'
gem 'minitest'
gem 'dotenv'
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
dotenv (3.2.0)
drb (2.2.3)
minitest (6.0.2)
drb (~> 2.0)
Expand All @@ -13,10 +14,12 @@ PLATFORMS
ruby

DEPENDENCIES
dotenv
minitest
rake

CHECKSUMS
dotenv (3.2.0) sha256=e375b83121ea7ca4ce20f214740076129ab8514cd81378161f11c03853fe619d
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
minitest (6.0.2) sha256=db6e57956f6ecc6134683b4c87467d6dd792323c7f0eea7b93f66bd284adbc3d
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ It is intended for lightweight run visibility: one small monitoring-start messag
- `web_search`
- other completed items
- Long payloads are split into safe chunks before posting
- `.env` loading without requiring additional gems
- `.env` loading via `dotenv`

## Project Layout

Expand Down
14 changes: 3 additions & 11 deletions lib/codex_notify/config.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require 'dotenv'
require 'etc'
require 'optparse'
require 'pathname'
Expand Down Expand Up @@ -31,17 +32,8 @@ def load_env_file(path = DEFAULT_ENV_PATH, override: false)
env_path = Pathname(path)
return unless env_path.exist?

env_path.read.each_line do |raw_line|
line = raw_line.strip
next if line.empty? || line.start_with?('#') || !line.include?('=')

key, value = line.split('=', 2)
key = key.strip
value = value.strip.gsub(/\A['"]|['"]\z/, '')
next if !override && ENV[key] && !ENV[key].empty?

ENV[key] = value
end
loader = override ? Dotenv.method(:overload) : Dotenv.method(:load)
loader.call(env_path.to_s)
end

def system_user_name
Expand Down
Loading