.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "Razor2::Client::Config 3" .TH Razor2::Client::Config 3 2026-04-06 "perl v5.42.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Razor2::Client::Config \- Configuration management for Vipul\*(Aqs Razor .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& # Typically used via Razor2::Client::Agent, not directly \& use Razor2::Client::Agent; \& \& my $agent = Razor2::Client::Agent\->new(\*(Aqrazor\-check\*(Aq); \& $agent\->read_options() or die $agent\->errstr; \& $agent\->do_conf() or die $agent\->errstr; \& \& # Access configuration values \& my $debuglevel = $agent\->{conf}{debuglevel}; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Razor2::Client::Config handles all configuration file and identity management for the Razor2 client. It reads and writes the \&\fIrazor\-agent.conf\fR configuration file, resolves the razorhome directory, and manages user identity files used for authentication with Razor servers. .PP This module is a parent class of Razor2::Client::Agent and is not typically instantiated directly. .SH METHODS .IX Header "METHODS" .IP \fBread_conf($params)\fR 4 .IX Item "read_conf($params)" Reads the Razor configuration. Resolves which config file to use (command\-line override, user home, or system default), merges defaults with file values and command\-line options, and stores the result in \&\f(CW\*(C`$self\->{conf}\*(C'\fR. .Sp \&\f(CW$params\fR is an optional hash reference of additional overrides. .Sp Returns the configuration hash reference on success. .IP \fBcompute_razorconf()\fR 4 .IX Item "compute_razorconf()" Determines the path to the \fIrazor\-agent.conf\fR file. Checks the user\*(Aqs razorhome first (\fI~/.razor/razor\-agent.conf\fR), then the system default (\fI/etc/razor/razor\-agent.conf\fR). Sets \f(CW\*(C`$self\->{razorconf}\*(C'\fR and \&\f(CW\*(C`$self\->{computed_razorconf}\*(C'\fR. .IP \fBwrite_conf($hash)\fR 4 .IX Item "write_conf($hash)" Writes configuration to the \fIrazor\-agent.conf\fR file. If \f(CW$hash\fR is not provided, reads the current file and merges with defaults. .IP \fBfind_home($rhome)\fR 4 .IX Item "find_home($rhome)" Resolves the razorhome directory. Search order: command\-line \f(CW\*(C`\-home\*(C'\fR option, \f(CW\*(C`razorhome\*(C'\fR from config file, \f(CW\*(C`$HOME/.razor/\*(C'\fR, config file directory. Sets \f(CW\*(C`$self\->{razorhome}\*(C'\fR. .Sp On VMS, uses \f(CW\*(C`_razor\*(C'\fR instead of \f(CW\*(C`.razor\*(C'\fR. .IP \fBcreate_home($rhome)\fR 4 .IX Item "create_home($rhome)" Creates the razorhome directory at \f(CW$rhome\fR with mode 0755. .IP \fBcompute_identity()\fR 4 .IX Item "compute_identity()" Resolves the identity file path from command\-line options, configuration, or the default (\fI/identity\fR). Follows symlinks. .IP \fBget_ident()\fR 4 .IX Item "get_ident()" Reads and returns the identity file as a hash reference with \f(CW\*(C`user\*(C'\fR and \&\f(CW\*(C`pass\*(C'\fR keys. Warns if the file is world\-readable. .IP \fBsave_ident($ident)\fR 4 .IX Item "save_ident($ident)" Writes an identity hash (\f(CW\*(C`user\*(C'\fR, \f(CW\*(C`pass\*(C'\fR) to disk with mode 0600. Creates a symlink from \fIidentity\fR to the user\-specific file unless \&\f(CW\*(C`\-i\*(C'\fR was specified. Falls back to file copy on systems without symlink support. .Sp Returns the identity file path on success. .ie n .IP "\fBread_file($filename, \fR\fB$defaults\fR\fB, \fR\fB$nothash\fR\fB)\fR" 4 .el .IP "\fBread_file($filename, \fR\f(CB$defaults\fR\fB, \fR\f(CB$nothash\fR\fB)\fR" 4 .IX Item "read_file($filename, $defaults, $nothash)" General\-purpose config file reader. In hash mode (default), parses \&\f(CW\*(C`key = value\*(C'\fR lines into a hash reference, skipping comments. In array mode (\f(CW$nothash\fR true), returns an array reference of lines. .Sp \&\f(CW$defaults\fR provides initial values that file contents override. .ie n .IP "\fBwrite_file($filename, \fR\fB$data\fR\fB, \fR\fB$append\fR\fB, \fR\fB$header\fR\fB, \fR\fB$lock\fR\fB)\fR" 4 .el .IP "\fBwrite_file($filename, \fR\f(CB$data\fR\fB, \fR\f(CB$append\fR\fB, \fR\f(CB$header\fR\fB, \fR\f(CB$lock\fR\fB)\fR" 4 .IX Item "write_file($filename, $data, $append, $header, $lock)" Writes data to a file. Accepts a hash reference (written as \f(CW\*(C`key = value\*(C'\fR), array reference (one item per line), or scalar reference (raw content). Supports append mode, a header string, and advisory file locking via \&\fBflock\fR\|(2). .IP \fBdefault_agent_conf()\fR 4 .IX Item "default_agent_conf()" Returns a hash reference of default agent configuration values. .IP \fBdefault_server_conf()\fR 4 .IX Item "default_server_conf()" Returns a hash reference of default per\-server configuration values. .SH FILES .IX Header "FILES" .IP \fI/etc/razor/razor\-agent.conf\fR 4 .IX Item "/etc/razor/razor-agent.conf" System\-wide configuration file. .IP \fI~/.razor/razor\-agent.conf\fR 4 .IX Item "~/.razor/razor-agent.conf" Per\-user configuration file (takes precedence over system config). .IP \fI~/.razor/identity\fR 4 .IX Item "~/.razor/identity" Symlink to the active identity file. .IP \fI~/.razor/identity\-\fR 4 .IX Item "~/.razor/identity-" Identity file containing credentials for a registered user. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBrazor\-agent.conf\fR\|(5), Razor2::Client::Agent, Razor2::Client::Core .SH AUTHORS .IX Header "AUTHORS" Vipul Ved Prakash, .SH LICENSE .IX Header "LICENSE" This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.