{"id":26150430,"url":"https://github.com/3liz/pg-event-server","last_synced_at":"2025-08-10T22:44:52.479Z","repository":{"id":151578053,"uuid":"623971720","full_name":"3liz/pg-event-server","owner":"3liz","description":"Dispatch Postgres NOTIFY as SSE notifications","archived":false,"fork":false,"pushed_at":"2025-06-19T20:26:41.000Z","size":161,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-07-19T16:32:12.808Z","etag":null,"topics":["postgresql","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/3liz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-05T13:26:59.000Z","updated_at":"2025-06-19T20:26:44.000Z","dependencies_parsed_at":"2024-11-19T05:40:23.542Z","dependency_job_id":null,"html_url":"https://github.com/3liz/pg-event-server","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/3liz/pg-event-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3liz%2Fpg-event-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3liz%2Fpg-event-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3liz%2Fpg-event-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3liz%2Fpg-event-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3liz","download_url":"https://codeload.github.com/3liz/pg-event-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3liz%2Fpg-event-server/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269799505,"owners_count":24477643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postgresql","rust"],"created_at":"2025-03-11T05:59:30.496Z","updated_at":"2025-08-10T22:44:52.429Z","avatar_url":"https://github.com/3liz.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTTP Postgres event server\n\nRelay Postgres event to HTTP SSE channels.\n\n1. Configure published Postgres channels \n2. Client subscribe to SSE channels \n3. Relay event to SSE subscribers.\n\n## Features\n\n* Multiple databases\n* TLS connection support for remote postgres server\n* SSL server connection\n\n## Operational \n\nAt startup, the server open LISTEN sessions to configured remote postgres \nserver(s).\n\nClients connect to server with HTTP connection opened in SSE mode using predefined\nsubscription url (see below). \n\nAll events received from remote database are\nbroadcasted to connected clients.\n\n## Running the server \n\n```\nUsage: pg-event-server [OPTIONS] --conf \u003cCONF\u003e\n\nOptions:\n      --conf \u003cCONF\u003e  Path to configuration file\n  -v, --verbose...   Increase verbosity\n      --check        Check configuration only\n  -h, --help         Print help\n  -V, --version      Print version\n```\n\n## Configuration\n\nConfiguration is in [\"toml\"](https://github.com/toml-lang/toml/wiki) format.\n\n### `[Server]` settings\n\n* `title` - Server title that will appear in the `Server` header; optional.\n* `listen` - Interface to listen to as `interface:port` string; required.\n* `ssl_enabled` - Enable SSL http connections (default to `false`)\n* `ssl_key_file` - Path to SSL key  file (absolute or relative to config file)\n* `ssl_key_file` - Path to SSL cert file (absolute or relative to config file)\n\n### `[postgres_tls]` \n\n* `tls_ca_file` - CA cert file for self-signed certificats\n* `tls_client_auth_key` - Path to key file that contains the client authentification \n   key to present to remote server.\n* `tls_client_auth_cert` - Path to cert file containing the client authentification \n   cert to present to remote server\n\n### `[[channel]]`\n\nPostgres channel configuration.\n\nA channel configuration has the following format: \n\n```\n[[channel]]\nid = \"my/test\"\nallowed_events = [\"foo\", \"bar\", \"baz\"]\nconnection_string = \"service=local\"\n```\n\nThere is no limit in the number of channels that can de declared in the\nconfiguration.\n\n#### Channel parameters\n\n* `id` - The identification of the channel: it should be formatted as a valid path.\n         The `id` will be used as the subscription path for clients. \n* `allowed_events` - Optional - The list of events that will be forwarded \n   to the client listening to that channel. If not present, all events will be forwarded.\n* `connection_string` - The postgres connection string. The format of the connection \n   follow the forme described [here](https://docs.rs/tokio-postgres/latest/tokio_postgres/config/struct.Config.html).\n   If the connection string *starts* with \"service=\" then the corresponding service\n   will be searched using the same rules as used for service in [libpq](https://docs.postgresql.fr/10/libpq-pgservice.html)\n\nFurthemore the following environment variables are supported:\n\n* `PGSERVICE` - Name of the postgres service used for connection params.\n* `PGSYSCONFDIR` - Location of the service files.\n* `PGSERVICEFILE` - Name of the service file.\n* `PGHOST` - behaves the same as the `host` connection parameter.\n* `PGPORT` - behaves the same as the `port` connection parameter.\n* `PGDATABASE` - behaves the same as the `dbname` connection parameter.\n* `PGUSER` - behaves the same as the user connection parameter.\n* `PGOPTIONS` - behaves the same as the `options` parameter.\n* `PGAPPNAME` - behaves the same as the `application_name` connection parameter.\n* `PGCONNECT_TIMEOUT` - behaves the same as the `connect_timeout` connection parameter.\n* `PGPASSFILE` - Specifies the name of the file used to store password.\n\n*Note*: tokio-postgres 0.7.9 [introduced a change](https://github.com/3liz/pg-event-server/issues/1)\npreventing `PGUSER` and service configuration to set connection user. \nThe [release of tokio-postgres 0.7.10](https://github.com/sfackler/rust-postgres/blob/master/tokio-postgres/CHANGELOG.md#v0710---2023-08-25)\nfix this issue.\n\n### Postgres channel configurations in separate files\n\nMultiple channel configurations will be searched in the `\u003cconfig_name\u003e.d` directory located\nat the same lever as the configuration file `\u003cconfig_name\u003e.toml`.\n\nAll files ending by `.toml` will be loaded for channel configuration.\n\n### Subscription url\n\n```\nhttp://{host:port}/event/subscribe/{channel_path}\"\n```\n\nWhere `{channel_path}` is any `id` configured to a Postgres event channel.\n\n## Connection to databases\n\nThe server allow to connecting to multiple database defined in the channel. \nThere will be only one connection per user, host and database. \n\nThese connections are open at server startup and no more connection \nwill be opened during the running time of the server.\n\n## TLS support for database connection\n\nTLS connection are available from [`rustls`](https://docs.rs/rustls/latest/rustls/) \nimplementation, \n\n### Using self-signed CA certificates\n\nBy default, platform certficates are used for checking the validity of the server certificate.\n\nCuste CA certficates may be used with the  `tls_ca_file` option in `[the postgres_tls]` section.\nIn this case platform certificates are not used.\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3liz%2Fpg-event-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3liz%2Fpg-event-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3liz%2Fpg-event-server/lists"}