comparison xml/en/docs/njs/reference.xml @ 2983:67dd348c9757

Documented new global nginx properties in njs Reference. The following properties were added: ngx.build, ngx.conf_file_path, ngx.error_log_path, ngx.prefix, ngx.version, ngx.version_number.
author Yaroslav Zhuravlev <yar@nginx.com>
date Thu, 01 Jun 2023 17:12:18 +0100
parents 02889d1bab78
children 2b161541806a
comparison
equal deleted inserted replaced
2982:02889d1bab78 2983:67dd348c9757
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> 7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd">
8 8
9 <article name="Reference" 9 <article name="Reference"
10 link="/en/docs/njs/reference.html" 10 link="/en/docs/njs/reference.html"
11 lang="en" 11 lang="en"
12 rev="106"> 12 rev="107">
13 13
14 <section id="summary"> 14 <section id="summary">
15 15
16 <para> 16 <para>
17 <link doc="index.xml">njs</link> provides objects, methods and properties 17 <link doc="index.xml">njs</link> provides objects, methods and properties
1150 <para> 1150 <para>
1151 The <literal>ngx</literal> global object is available 1151 The <literal>ngx</literal> global object is available
1152 since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>. 1152 since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>.
1153 <list type="tag"> 1153 <list type="tag">
1154 1154
1155 <tag-name id="ngx_build"><literal>ngx.build</literal></tag-name>
1156 <tag-desc>
1157 a string containing an optional nginx build name, corresponds to the
1158 <link doc="../configure.xml" id="build"><literal>--build=name</literal></link>
1159 argument
1160 of the <link doc="../configure.xml">configure</link> script,
1161 by default is <literal>""</literal>
1162 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>)
1163 </tag-desc>
1164
1165 <tag-name id="ngx_conf_file_path"><literal>ngx.conf_file_path</literal></tag-name>
1166 <tag-desc>
1167 a string containing the file path to current nginx configuration file
1168 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>)
1169 </tag-desc>
1170
1155 <tag-name id="ngx_conf_prefix"><literal>ngx.conf_prefix</literal></tag-name> 1171 <tag-name id="ngx_conf_prefix"><literal>ngx.conf_prefix</literal></tag-name>
1156 <tag-desc> 1172 <tag-desc>
1157 a string containing the file path to 1173 a string containing the file path to
1158 <link doc="../configure.xml" id="prefix">nginx configuration prefix</link>&mdash; 1174 <link doc="../configure.xml" id="conf_path">nginx configuration prefix</link>&mdash;
1159 the directory where nginx is currently looking for configuration 1175 the directory where nginx is currently looking for configuration
1160 (<link doc="changes.xml" id="njs0.7.8">0.7.8</link>) 1176 (<link doc="changes.xml" id="njs0.7.8">0.7.8</link>)
1177 </tag-desc>
1178
1179 <tag-name id="ngx_error_log_path"><literal>ngx.error_log_path</literal></tag-name>
1180 <tag-desc>
1181 a string containing the file path to the current
1182 <link doc="../ngx_core_module.xml" id="error_log">error log</link> file
1183 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>)
1161 </tag-desc> 1184 </tag-desc>
1162 1185
1163 <tag-name id="ngx_fetch"><literal>ngx.fetch(<value>resource</value>, 1186 <tag-name id="ngx_fetch"><literal>ngx.fetch(<value>resource</value>,
1164 [<value>options</value>])</literal></tag-name> 1187 [<value>options</value>])</literal></tag-name>
1165 <tag-desc> 1188 <tag-desc>
1238 </tag-desc> 1261 </tag-desc>
1239 1262
1240 <tag-name id="ngx_log"><literal>ngx.log</literal>(<value>level</value>, 1263 <tag-name id="ngx_log"><literal>ngx.log</literal>(<value>level</value>,
1241 <value>message</value>)</tag-name> 1264 <value>message</value>)</tag-name>
1242 <tag-desc> 1265 <tag-desc>
1243 Writes a message to the error log with the specified level of logging. 1266 writes a message to the error log with the specified level of logging.
1244 The <value>level</value> parameter specifies one of the log levels, 1267 The <value>level</value> parameter specifies one of the log levels,
1245 the <value>message</value> parameter can be a string or Buffer. 1268 the <value>message</value> parameter can be a string or Buffer.
1246 The following log levels can be specified: 1269 The following log levels can be specified:
1247 <literal>ngx.INFO</literal>, 1270 <literal>ngx.INFO</literal>,
1248 <literal>ngx.WARN</literal>, and 1271 <literal>ngx.WARN</literal>, and
1253 <link doc="../dev/development_guide.xml" id="logging">hardcoded</link> 1276 <link doc="../dev/development_guide.xml" id="logging">hardcoded</link>
1254 maximum line length limit, 1277 maximum line length limit,
1255 only first 2048 bytes of the string can be logged. 1278 only first 2048 bytes of the string can be logged.
1256 </note> 1279 </note>
1257 </para> 1280 </para>
1281 </tag-desc>
1282
1283 <tag-name id="ngx_prefix"><literal>ngx.prefix</literal></tag-name>
1284 <tag-desc>
1285 a string containing the file path to
1286 <link doc="../configure.xml" id="prefix">nginx prefix</link>&mdash;
1287 a directory that keeps server files
1288 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>)
1289 </tag-desc>
1290
1291 <tag-name id="ngx_version"><literal>ngx.version</literal></tag-name>
1292 <tag-desc>
1293 a string containing nginx version,
1294 for example: <literal>1.25.0</literal>
1295 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>)
1296 </tag-desc>
1297
1298 <tag-name id="ngx_version_number"><literal>ngx.version_number</literal></tag-name>
1299 <tag-desc>
1300 a number containing nginx version,
1301 for example: <literal>1025000</literal>
1302 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>)
1303 </tag-desc>
1304
1305 <tag-name id="ngx_worker_id"><literal>ngx.worker_id</literal></tag-name>
1306 <tag-desc>
1307 a number that corresponds to nginx internal worker id,
1308 the value is between <literal>0</literal> and the value specified in the
1309 <link doc="../ngx_core_module.xml" id="worker_processes"/> directive
1310 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>)
1258 </tag-desc> 1311 </tag-desc>
1259 1312
1260 </list> 1313 </list>
1261 </para> 1314 </para>
1262 1315