Commit ac440720 authored by Panagiotis Skarvelis's avatar Panagiotis Skarvelis
Browse files

nip

parent ff4cb431
# AuditRecordDB
According to Common Guide for Client Applications of GSIS, (https://www.gsis.gr/dimosia-dioikisi/ked/koinos-odigos)
all online services require the addition of tracking data (auditRecord) when calling. These data are used in order to record each call (request call) but also to be able to trace the calls that have been served.
all online services are required to have the addition of tracking data (auditRecord) when calling them.
So this module implements a JSON file storage database for use with audit mechanism of GSIS. It is following the interoperability_specsv1.4 and simplifies the integration with Nextjs/Nodejs projects.
This module implements a JSON file storage database for use with the audit mechanism of GSIS. It follows the interoperability_specsv1.4 and simplifies the integration with Nextjs/Nodejs projects.
Also provides a way for automating protocol numbers and transaction Id's, if your app does not provide them.
It also provides a way for automating protocol numbers and transactions Id's, if your app does not provide them.
# Usage
```
......@@ -36,8 +36,8 @@ console.log(auditRecordDB({},new FileEngine('/tmp/auditRecords')))
```
### Prostgresql
To work with Postgresql you need to use `PostgresqlEngine` instead of `FileEngine`
And you need to install native `libpg` library for Postgresql
To work with Postgresql, you need to use `PostgresqlEngine` instead of `FileEngine`
Moreover, have to install the native `libpg` library for Postgresql.
On macOS: brew install libpq
On Ubuntu/Debian: apt-get install libpq-dev g++ make
......@@ -95,12 +95,15 @@ columns:{
```
# AuditEngine
As default a file storage engine `FileEngine` is implement, please mind to change the storage path to your needs.
By default, the file storage engine `FileEngine` is used.
Please keep in mind to change the storage path to app needs.
You can also use PostgreSql Engine.
To make it work have to pass enviroment variables according to the documentation of the LIBPGSQL library. https://www.postgresql.org/docs/9.1/libpq-envars.html
The app can also use `PostgreSqlEngine`.
To make it work, pass environment variables according to the documentation of the LIBPGSQL library. https://www.postgresql.org/docs/9.1/libpq-envars.html
Also you can extend the store to another 'real' database, look at `FileEngine.ts` and `PostgreSqlEngine.ts` for examples.
Please remember that protocol and/or transaction id `sequences` will be created in the database if not provided.
Each day a new sequence will be created for protocol needs as `seqyyyyddmm_seq`.
So if you do not need to keep tracking on application, you may need to clean up those sequences from time to time using a cron job.
Look at `FileEngine.ts` and `PostgreSqlEngine.ts` for examples to extend the store to another 'real' database.
......@@ -8,6 +8,3 @@ const test = () => {
console.log("Audit Record Generator, simple test on postgresql");
test();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment