Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace table config with view for postgresql.conf #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ OBJS = src/pg_amqp.o \

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

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

DATA = $(wildcard updates/*--*.sql) sql/$(EXTENSION)--$(EXTVERSION).sql
Expand Down
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,38 @@ To update to the latest version, run the following command after running "make i

ALTER EXTENSION amqp UPDATE;

Setup
-----

Once you are all set, you can enter your credentials to `postgresql.conf`

This file is under you local postgres installation, e.g. ubuntu PostgreSQL 9.6
location may be: `/etc/postgresql/9.6/main/postgresql.conf`

format of the data is as follows:

```
amqp.broker = '[{ "broker_id": 1, "host": "px8.uol.cz", "port": "5670",
"vhost": "", "username": "expert", "password": "expert" }]'
```

This way you can enter how many configurations you want dividing your broker
configuration with comma like this:

```
amqp.broker = '[{ "broker_id": 1, "host": "host.cz", "port": "5672",
"vhost": "/", "username": "username", "password": "password" },
{ "broker_id": 2, "host": "host.cz", "port": "5672",
"vhost": "/", "username": "username", "password": "password" }]'
```

After changes in postgresql.conf you have to restart postgresql service, on
ubunutu look like this:

```
service postgresql restart
```

Basic Usage
-----------

Expand Down
11 changes: 0 additions & 11 deletions sql/tables/tables.sql

This file was deleted.

3 changes: 3 additions & 0 deletions sql/views/views.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE OR REPLACE VIEW @extschema@.broker AS
select * from json_to_recordset(current_setting('amqp.broker')::json)
as x(broker_id int, host text, port int, vhost text, username text, password text);