class Gmaps::ConfigLoader

Defined in:

gmaps/config.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(config_dir : String | Nil = nil) #

Constructor Initializes the API key and sets up the config directory and file path

Params:

  • config_dir (String?) - Optional custom configuration directory path

[View source]

Class Method Detail

def self.config_dir_exists?(config_dir : String | Nil = nil) : Bool #

does config_dir exist?


[View source]
def self.get_config_dir(config_dir : String | Nil = nil) : Path #

Determines the default configuration directory based on environment variables or a fallback

Returns:

  • (Path) - The configuration directory path

[View source]

Instance Method Detail

def config_dir : Path #

Getter for the configuration directory path


[View source]
def config_file : Path #

Getter for the configuration file path


[View source]
def config_file_exists? #

Checks if the config file exists


[View source]
def edit_key(api_key : String) #

Edits the API key stored in the config file

Params:

  • api_key (String) - The new API key to store

[View source]
def get_key #

Retrieves the API key from the config file

Returns:

  • (String) - The API key

[View source]
def get_key? #

Retrieves the API key from the config file, returning nil if not found

Returns:

  • (String | Nil) - The API key or nil if not found

[View source]
def keyfile : Path #

Getter for the keyfile path


[View source]
def open_config_file #

Opens the config file for editing using the default editor or the EDITOR environment variable


[View source]
def secrets_class #

[View source]
def to_yaml #

[View source]
def yaml_config #

[View source]