Razor2:...:Config(3)

πŸ“¦ version 2.88, in arch rolling

πŸ’– Razor2::Client::Config πŸ’–

okay bestie, welcome to the Razor2:...:Config(3) page under User Contributed Perl Documentation. This is the manual for Razor2::Client::Config, and it’s giving config brain energy: config files, razorhome, identity files, auth vibes. πŸ’…

✨ NAME ✨

Razor2::Client::Config - Configuration management for Vipul's Razor. 🫢

🌸 SYNOPSIS 🌸

# Typically used via Razor2::Client::Agent, not directly
use Razor2::Client::Agent;

my $agent = Razor2::Client::Agent->new('razor-check');
$agent->read_options() or die $agent->errstr;
$agent->do_conf()      or die $agent->errstr;

# Access configuration values
my $debuglevel = $agent->{conf}{debuglevel};

πŸ¦‹ DESCRIPTION πŸ¦‹

So Razor2::Client::Config handles all the configuration file and identity management for the Razor2 client. It reads and writes the razor-agent.conf configuration file, resolves the razorhome directory, and manages user identity files used for authentication with Razor servers. Iconic. ✨

This module is a parent class of Razor2::Client::Agent, and it’s not typically instantiated directly. iykyk β€” usually the Agent is the main character here. πŸ‘‘

πŸ› οΈ METHODS πŸ› οΈ

read_conf($params)

Reads the Razor configuration. Resolves which config file to use β€” command-line override, user home, or system default β€” then merges defaults with file values and command-line options, and stores the result in $self->{conf}. πŸ’–

$params is an optional hash reference of additional overrides.

Returns the configuration hash reference on success.

compute_razorconf()

Determines the path to the razor-agent.conf file. Checks the user's razorhome first (~/.razor/razor-agent.conf), then the system default (/etc/razor/razor-agent.conf). Sets $self->{razorconf} and $self->{computed_razorconf}. πŸŽ€

write_conf($hash)

Writes configuration to the razor-agent.conf file. If $hash is not provided, reads the current file and merges with defaults. No cap. ✨

find_home($rhome)

Resolves the razorhome directory. Search order, bestie:

  1. command-line -home option
  2. razorhome from config file
  3. $HOME/.razor/
  4. config file directory

Sets $self->{razorhome}.

On VMS, uses _razor instead of .razor. 🌈

create_home($rhome)

Creates the razorhome directory at $rhome with mode 0755. Slay. πŸ’…

compute_identity()

Resolves the identity file path from command-line options, configuration, or the default (<razorhome>/identity). Follows symlinks. πŸ¦‹

get_ident()

Reads and returns the identity file as a hash reference with "user" and "pass" keys. Warns if the file is world-readable. πŸ‘€

save_ident($ident)

Writes an identity hash ("user", "pass") to disk with mode 0600. Creates a symlink from identity to the user-specific file unless -i was specified. Falls back to file copy on systems without symlink support. πŸ”₯

Returns the identity file path on success.

read_file($filename, $defaults, $nothash)

General-purpose config file reader. In hash mode (the default), parses key = value lines into a hash reference, skipping comments. In array mode ($nothash true), returns an array reference of lines. πŸ“

$defaults provides initial values that file contents override.

write_file($filename, $data, $append, $header, $lock)

Writes data to a file. Accepts a hash reference (written as key = value), an array reference (one item per line), or a scalar reference (raw content). Supports append mode, a header string, and advisory file locking via flock(2). πŸ”’

default_agent_conf()

Returns a hash reference of default agent configuration values. 🌟

default_server_conf()

Returns a hash reference of default per-server configuration values. 🌟

πŸ—‚οΈ FILES πŸ—‚οΈ

  • /etc/razor/razor-agent.conf β€” system-wide configuration file. πŸ›οΈ
  • ~/.razor/razor-agent.conf β€” per-user configuration file (takes precedence over system config). πŸ‘‘
  • ~/.razor/identity β€” symlink to the active identity file. πŸ”—
  • ~/.razor/identity-<user> β€” identity file containing credentials for a registered user. πŸͺͺ

πŸ‘€ SEE ALSO πŸ‘€

✍️ AUTHORS ✍️

Vipul Ved Prakash, <mail@vipul.net> πŸ’–

πŸ“œ LICENSE πŸ“œ

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 🫢


πŸ’Œ cute sign-off: this page is from perl v5.44.0, dated 2026-10-17, and the manual page name is Razor2:...:Config(3). Bye bestie, go configure something iconic. πŸ’…βœ¨

πŸ“¦ where this page comes from