Module: OllamaChat::EnvConfig

Includes:
ConstConf
Defined in:
lib/ollama_chat/env_config.rb

Overview

Environment configuration module for OllamaChat

This module provides a structured way to manage environment variables and configuration settings for the OllamaChat application. It uses the ConstConf library to define and manage configuration parameters with default values, descriptions, and decoding logic.

The module organizes configuration into logical sections including general settings, Ollama-specific configurations, and chat-specific options.

Defined Under Namespace

Modules: OLLAMA

Constant Summary collapse

XDG_CONFIG_HOME =
set do
  description 'XDG Configuration directory path'
  default { '~/.config' }
  decode  { Pathname.new(_1) + 'ollama_chat' }
end
XDG_CACHE_HOME =
set do
  description 'XDG Cache directory path'
  default { '~/.cache' }
  decode  { Pathname.new(_1) + 'ollama_chat' }
end
PAGER =
set do
  description 'Pager command to use in case terminal lines are exceeded by output'

  default do
    if fallback_pager = `which less`.full?(:chomp) || `which more`.full?(:chomp)
      fallback_pager << ' -r'
    end
  end
end
EDITOR =
set do
  description 'Editor to use'

  default do
    if  editor = %w[ vim vi ].find { `which #{_1}`.full?(:chomp) }
      editor
    else
      warn 'Need an editor command configured via env var "EDITOR"'
    end
  end
end
DIFF_TOOL =
set do
  description 'Diff tool to apply changes with'

  default do
    if  diff = `which vimdiff`.full?(:chomp)
      diff
    else
      warn 'Need a diff tool configured via env var "DIFF_TOOL"'
    end
  end
end
KRAMDOWN_ANSI_OLLAMA_CHAT_STYLES =
set do
  description 'Styles to use for kramdown-ansi markdown'

  default ENV['KRAMDOWN_ANSI_STYLES'].full?
end