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

chore(csi-162): added redis proxyCache impl.; updated interfaces #4

Merged
merged 14 commits into from
Jun 25, 2024
Merged
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
40 changes: 39 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ defaults_docker_Dependencies: &defaults_docker_Dependencies |
apk --no-cache add bash bash-doc bash-completion
npm install -g node-gyp

defaults_machine_Dependencies: &defaults_machine_Dependencies |
## Add Package Repos
## Ref: https://docs.confluent.io/platform/current/installation/installing_cp/deb-ubuntu.html#get-the-software
wget -qO - https://packages.confluent.io/deb/7.4/archive.key | sudo apt-key add -
sudo add-apt-repository -y "deb https://packages.confluent.io/clients/deb $(lsb_release -cs) main"

## Install deps
sudo apt install -y curl bash musl-dev libsasl2-dev
sudo ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1

defaults_awsCliDependencies: &defaults_awsCliDependencies |
apk --no-cache add aws-cli

Expand All @@ -46,6 +56,8 @@ defaults_npm_publish_release: &defaults_npm_publish_release
npm ci
echo "Publishing tag $RELEASE_TAG"
npm publish --tag $RELEASE_TAG --access public
echo $(node -p "require('./package.json').name")
npm dist-tag add @mojaloop/inter-scheme-proxy-cache-lib@$RELEASE_TAG latest

defaults_export_version_from_package: &defaults_export_version_from_package
name: Format the changelog into the github release body and get release tag
Expand Down Expand Up @@ -241,6 +253,27 @@ jobs:
- store_test_results:
path: coverage

test-integration:
executor: default-machine
steps:
- run:
name: Install general dependencies
command: *defaults_machine_Dependencies
- checkout
- run:
<<: *defaults_configure_nvm
- run:
<<: *defaults_display_versions
- restore_cache:
key: dependency-cache-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Execute integration tests
command: |
docker compose build
docker compose up -d
npm run test:int
docker compose down -v

vulnerability-check:
executor: default-docker
steps:
Expand Down Expand Up @@ -439,7 +472,7 @@ workflows:
context: org-global
- setup:
context: org-global
filters:
filters: &BUILD_AND_TEST_FILTERS
tags:
only: /.*/
branches:
Expand Down Expand Up @@ -491,6 +524,11 @@ workflows:
ignore:
- /feature*/
- /bugfix*/
- test-integration:
context: org-global
requires:
- setup
filters: *BUILD_AND_TEST_FILTERS
- vulnerability-check:
context: org-global
requires:
Expand Down
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
LOG_LEVEL_PROXY_CACHE=debug

REDIS_HOST=localhost
REDIS_PORT=6379
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ npm install @mojaloop/inter-scheme-proxy-cache-lib

```typescript
// ESM
import { createProxyCache } from '@mojaloop/inter-scheme-proxy-cache-lib';
import { createProxyCache, STORAGE_TYPES } from '@mojaloop/inter-scheme-proxy-cache-lib';
// CJS
const { createProxyCache } = require('@mojaloop/inter-scheme-proxy-cache-lib');

const proxyCache = createProxyCache({ type: 'redis', ... });
const proxyCache = createProxyCache(STORAGE_TYPES.redis, {
host: localhost,
port: 6379,
...
});
// todo: define usefull example
await proxyCache.addDfspIdToProxyMapping('proxyId_1', { url: 'https://hab-a/proxy' });
await proxyCache.addDfspIdToProxyMapping('dfsp_1', 'proxyAB');
```

### TypeDoc
Expand All @@ -35,7 +39,7 @@ could be found [**here**](https://mojaloop.github.io/inter-scheme-proxy-cache-li

### API
```typescript
addDfspIdToProxyMapping: (dfspId: string, details: PoxyDetails) => Promise<boolean>;
addDfspIdToProxyMapping: (dfspId: string, proxyId: string) => Promise<boolean>;
// Add the proxyAdapter details of a particular DFSP to proxy mapping

...
Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3.9"

services:
redis:
image: redis:6.2.4-alpine
# image: redis/redis-stack:latest
restart: "unless-stopped"
environment:
- ALLOW_EMPTY_PASSWORD=yes
- REDIS_PORT=6379
- REDIS_REPLICATION_MODE=master
- REDIS_TLS_ENABLED=no
ports:
- "${REDIS_PORT}:6379"
2 changes: 1 addition & 1 deletion docs/assets/navigation.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/assets/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading