1Apache::TS::Config::RecUosredrs(C3o)ntributed Perl DocumAepnatcahtei:o:nTS::Config::Records(3)
2
3
4
6 Apache::TS::Config::Records - Manage the Apache Traffic Server
7 records.config file
8
10 #!/usr/bin/perl
11
12 use Apache::TS::Config::Records;
13
14 my $r = new Apache::TS::Config::Records(file => "/tmp/records.config");
15 $r->set(conf => "proxy.config.log.extended_log_enabled",
16 val => "123");
17 $r->write(file => "/tmp/records.config.new");
18
20 This module implements a convenient interface to read, modify and save
21 the records.config file as used by Apache Traffic Server.
22
23 Instantiating a new Config::Records class, with a file provided, will
24 automatically load that configuration. Don't call the load() method
25 explicitly in this case.
26
27 API Methods
28 The following are methods in the Records class.
29
30 new Instantiate a new object. The file name is optionally provided,
31 and if present that file is immediately loaded (see the load()
32 method below). Example:
33
34 my $r = new Apache::TS::Config::Records(file => $fname);
35
36 load Explicitly load a configuration file, merging the items with
37 any existing values. This is useful to for example merge
38 multiple configuration into one single structure
39
40 get Get an existing configuration line. This is useful for
41 detecting that a config exists or not, for example. The return
42 value is an anonymous array like
43
44 [<line string>, [value split into 4 fields, flag if changed]
45
46 You probably shouldn't modify this array.
47
48 set Modify one configuration value, with the provided value. Both
49 the conf name and the value are required. Example:
50
51 $r->set(conf => "proxy.config.exec_thread.autoconfig",
52 val => "0");
53
54 conf is short for "config", val is short for "value", and all
55 are acceptable.
56
57 remove Remove a specified configuration, the mandatory option is conf
58 (or "config"). Example:
59
60 $r->remove(conf => "proxy.config.exec_thread.autoconfig");
61
62 append Append a string to the "end" of the finished configuration
63 file. We will assure that no duplicated configurations are
64 added. The input is a single line, as per the normal
65 records.config syntax. The purpose of this is to add new
66 sections to the configuration, with appropriate comments etc.
67 Example:
68
69 $r->append(line => "");
70 $r->append(line => "# My local stuff");
71 $r->set(conf => "proxy.config.dns.dedicated_thread",
72 val => "1");
73
74 write Write the new configuration file to STDOUT, or a filename if
75 provided. Example:
76
77 $r->write(file => "/etc/trafficserver/records.config");
78
80 Apache::TS::Config
81
82
83
84perl v5.38.0 2023-10-11 Apache::TS::Config::Records(3)