Unleash / unleash-client-node

Unleash client SDK for Node.js
https://docs.getunleash.io
Apache License 2.0
210 stars 71 forks source link

Default to not creating files and clean up flies created during unit tests. #649

Closed DevinCrumb closed 1 month ago

DevinCrumb commented 1 month ago

Describe the feature request

The Unleash Client is creating unwanted and prosibly problimatic files. The application may not have permission to write to the directory used by the client or there may be other reasons where creating a file is problematic. Default should be to not use the file system.

Also, when running the Unit Test, it creates files that it does not clean up. The Unit test needs to make sure any files it creates, it deletes when the test ends, even when the test fails.

Background

No response

Solution suggestions

No response

ivarconr commented 1 month ago

Hi,

you can customize this behaviour yourself via a custom store provider and the Node SDK comes with the InMemStorageProvider:

import { initialize, InMemStorageProvider } from 'unleash-client';

const client = initialize({
  appName: 'my-application',
  url: 'http://localhost:3000/api/',
  customHeaders: { Authorization: '<YOUR_API_TOKEN>' },
  storageProvider: new InMemStorageProvider(),
});