Module: Brainiac::Plugins::Github::Config

Defined in:
lib/brainiac/plugins/github/config.rb

Constant Summary collapse

CONFIG_FILE =
File.join(ENV.fetch("BRAINIAC_DIR", File.join(Dir.home, ".brainiac")), "github.json")

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject (readonly)

Returns the value of attribute config.



13
14
15
# File 'lib/brainiac/plugins/github/config.rb', line 13

def config
  @config
end

Class Method Details

.load!Object



15
16
17
18
# File 'lib/brainiac/plugins/github/config.rb', line 15

def load!
  @config = load_config
  @last_mtime = File.exist?(CONFIG_FILE) ? File.mtime(CONFIG_FILE) : nil
end

.reload!Object



20
21
22
23
24
25
26
# File 'lib/brainiac/plugins/github/config.rb', line 20

def reload!
  return unless file_changed?

  @config = load_config
  @last_mtime = File.exist?(CONFIG_FILE) ? File.mtime(CONFIG_FILE) : nil
  LOG.info "[GitHub] Reloaded configuration"
end

.webhook_secretObject



28
29
30
# File 'lib/brainiac/plugins/github/config.rb', line 28

def webhook_secret
  @config["webhook_secret"] || ENV.fetch("GITHUB_WEBHOOK_SECRET", nil)
end