Skip to content

Commit 3c13410

Browse files
committed
Replace table config with view for postgresql.conf
fixes #21
1 parent 1290d7c commit 3c13410

File tree

4 files changed

+36
-12
lines changed

4 files changed

+36
-12
lines changed

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ OBJS = src/pg_amqp.o \
1818

1919
all: sql/$(EXTENSION)--$(EXTVERSION).sql
2020

21-
sql/$(EXTENSION)--$(EXTVERSION).sql: sql/tables/*.sql sql/functions/*.sql
21+
sql/$(EXTENSION)--$(EXTVERSION).sql: sql/views/*.sql sql/functions/*.sql
2222
cat $^ > $@
2323

2424
DATA = $(wildcard updates/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql

Diff for: README.md

+32
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,38 @@ To update to the latest version, run the following command after running "make i
7777

7878
ALTER EXTENSION amqp UPDATE;
7979

80+
Setup
81+
-----
82+
83+
Once you are all set, you can enter your credentials to `postgresql.conf`
84+
85+
This file is under you local postgres installation, e.g. ubuntu PostgreSQL 9.6
86+
location may be: `/etc/postgresql/9.6/main/postgresql.conf`
87+
88+
format of the data is as follows:
89+
90+
```
91+
amqp.broker = '[{ "broker_id": 1, "host": "px8.uol.cz", "port": "5670",
92+
"vhost": "", "username": "expert", "password": "expert" }]'
93+
```
94+
95+
This way you can enter how many configurations you want dividing your broker
96+
configuration with comma like this:
97+
98+
```
99+
amqp.broker = '[{ "broker_id": 1, "host": "host.cz", "port": "5672",
100+
"vhost": "/", "username": "username", "password": "password" },
101+
{ "broker_id": 2, "host": "host.cz", "port": "5672",
102+
"vhost": "/", "username": "username", "password": "password" }]'
103+
```
104+
105+
After changes in postgresql.conf you have to restart postgresql service, on
106+
ubunutu look like this:
107+
108+
```
109+
service postgresql restart
110+
```
111+
80112
Basic Usage
81113
-----------
82114

Diff for: sql/tables/tables.sql

-11
This file was deleted.

Diff for: sql/views/views.sql

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CREATE OR REPLACE VIEW @[email protected] AS
2+
select * from json_to_recordset(current_setting('amqp.broker')::json)
3+
as x(broker_id int, host text, port int, vhost text, username text, password text);

0 commit comments

Comments
 (0)