Skip to content

Commit 9ad608b

Browse files
committed
Prettify take FRiCKLE#2.
1 parent 1784ba8 commit 9ad608b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
About
22
=====
3+
34
`ngx_postgres` is an upstream module that allows `nginx` to communicate directly with `PostgreSQL` database.
45

56
Response is generated in `rds` format, so it's compatible with `ngx_rds_json` and `ngx_drizzle` modules.
67

78

89
Status
910
======
11+
1012
This module is production-ready and it's compatible with following nginx releases:
1113

1214
- 0.7.x (tested with 0.7.60 to 0.7.67),
@@ -15,8 +17,10 @@ This module is production-ready and it's compatible with following nginx release
1517

1618
Configuration directives
1719
========================
20+
1821
postgres_server
1922
---------------
23+
2024
**syntax**: `postgres_server ip[:port] dbname=dbname user=user password=pass`
2125
**default**: `none`
2226
**context**: `upstream`
@@ -26,6 +30,7 @@ Set details about the database server.
2630

2731
postgres_keepalive
2832
------------------
33+
2934
**syntax**: `postgres_keepalive off | max=count [mode=single|multi] [overflow=ignore|reject]`
3035
**default**: `max=10 mode=single overflow=ignore`
3136
**context**: `upstream`
@@ -39,6 +44,7 @@ Configure keepalive parameters:
3944

4045
postgres_pass
4146
-------------
47+
4248
**syntax**: `postgres_pass upstream`
4349
**default**: `none`
4450
**context**: `location`
@@ -48,6 +54,7 @@ Set name of an upstream block that will be used for the database connections (it
4854

4955
postgres_query
5056
--------------
57+
5158
**syntax**: `postgres_query [methods] query`
5259
**default**: `none`
5360
**context**: `http`, `server`, `location`
@@ -59,6 +66,7 @@ This directive can be used more than once within same context.
5966

6067
postgres_rewrite
6168
----------------
69+
6270
**syntax**: `postgres_rewrite [methods] condition status_code`
6371
**default**: `none`
6472
**context**: `http`, `server`, `location`
@@ -77,6 +85,7 @@ This directive can be used more than once within same context.
7785

7886
postgres_output
7987
---------------
88+
8089
**syntax**: `postgres_output none|value|row|rds [row] [column]`
8190
**default**: `rds`
8291
**context**: `http`, `server`, `location`
@@ -93,6 +102,7 @@ Row and column numbers start at 0. Column name can be used instead of column num
93102

94103
postgres_set
95104
------------
105+
96106
**syntax**: `postgres_set $variable row column [optional|required]`
97107
**default**: `none`
98108
**context**: `http`, `server`, `location`
@@ -106,6 +116,7 @@ This directive can be used more than once within same context.
106116

107117
postgres_escape
108118
---------------
119+
109120
**syntax**: `postgres_escape $escaped $unescaped`
110121
**default**: `none`
111122
**context**: `http`, `server`, `location`
@@ -115,6 +126,7 @@ Escape and quote `$unescaped` variable. Result is stored in `$escaped` variable
115126

116127
postgres_connect_timeout
117128
------------------------
129+
118130
**syntax**: `postgres_connect_timeout timeout`
119131
**default**: `10s`
120132
**context**: `http`, `server`, `location`
@@ -124,6 +136,7 @@ Set timeout for connecting to the database.
124136

125137
postgres_result_timeout
126138
-----------------------
139+
127140
**syntax**: `postgres_result_timeout timeout`
128141
**default**: `30s`
129142
**context**: `http`, `server`, `location`
@@ -133,30 +146,37 @@ Set timeout for receiving result from the database.
133146

134147
Configuration variables
135148
=======================
149+
136150
$postgres_columns
137151
-----------------
152+
138153
Number of columns in received result-set.
139154

140155

141156
$postgres_rows
142157
--------------
158+
143159
Number of rows in received result-set.
144160

145161

146162
$postgres_affected
147163
------------------
164+
148165
Number of rows affected by `INSERT`, `UPDATE`, `DELETE`, `MOVE`, `FETCH` or `COPY` SQL query.
149166

150167

151168
$postgres_query
152169
---------------
170+
153171
SQL query, as seen by `PostgreSQL` database.
154172

155173

156174
Sample configurations
157175
=====================
176+
158177
Sample configuration #1
159178
-----------------------
179+
160180
Return content of table `cats` (in `rds` format).
161181

162182
http {
@@ -176,6 +196,7 @@ Return content of table `cats` (in `rds` format).
176196

177197
Sample configuration #2
178198
-----------------------
199+
179200
Return only those rows from table `sites` that match `host` filter which is evaluated for each request based on its `$http_host` variable.
180201

181202
http {
@@ -195,6 +216,7 @@ Return only those rows from table `sites` that match `host` filter which is eval
195216

196217
Sample configuration #3
197218
-----------------------
219+
198220
Pass request to the backend selected from the database (traffic router).
199221

200222
http {
@@ -224,6 +246,7 @@ Required modules (other than `ngx_postgres`):
224246

225247
Sample configuration #4
226248
-----------------------
249+
227250
Restrict access to local files by authenticating against `PostgreSQL` database.
228251

229252
http {
@@ -259,6 +282,7 @@ Required modules (other than `ngx_postgres`):
259282

260283
Sample configuration #5
261284
-----------------------
285+
262286
Simple RESTful webservice returning JSON responses with appropriate HTTP status codes.
263287

264288
http {
@@ -307,6 +331,7 @@ Required modules (other than `ngx_postgres`):
307331

308332
Testing
309333
=======
334+
310335
`ngx_postgres` comes with complete test suite based on [Test::Nginx](http://github.com/agentzh/test-nginx).
311336

312337
You can test core functionality using:
@@ -328,6 +353,7 @@ using:
328353

329354
License
330355
=======
356+
331357
Copyright (c) 2010, FRiCKLE Piotr Sikora <info@frickle.com>
332358
Copyright (c) 2009-2010, Xiaozhe Wang <chaoslawful@gmail.com>
333359
Copyright (c) 2009-2010, Yichun Zhang <agentzh@gmail.com>
@@ -360,6 +386,7 @@ This software includes also parts of the code from `nginx` (copyrighted by **Igo
360386

361387
See also
362388
========
389+
363390
- [ngx_rds_json](http://github.com/agentzh/rds-json-nginx-module),
364391
- [ngx_drizzle](http://github.com/chaoslawful/drizzle-nginx-module),
365392
- [ngx_lua](http://github.com/chaoslawful/lua-nginx-module),

0 commit comments

Comments
 (0)