mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 08:19:07 +00:00
enable encryption from cli
This commit is contained in:
parent
c38d159565
commit
ed3e460e7a
@ -4,9 +4,10 @@ import zip from 'zlib';
|
||||
import { Duplex } from 'stream';
|
||||
import { chain, Writable } from 'stream-chain';
|
||||
import { stringer } from 'stream-json/jsonl/Stringer';
|
||||
import type { Cipher } from 'crypto';
|
||||
|
||||
import type { IDestinationProvider, ProviderType, Stream } from '../../types';
|
||||
// import { encrypt } from '../encryption';
|
||||
import { createCipher } from '../encryption/encrypt';
|
||||
|
||||
export interface ILocalFileDestinationProviderOptions {
|
||||
// Encryption
|
||||
@ -37,6 +38,7 @@ class LocalFileDestinationProvider implements IDestinationProvider {
|
||||
name: string = 'destination::local-file';
|
||||
type: ProviderType = 'destination';
|
||||
options: ILocalFileDestinationProviderOptions;
|
||||
cipher?: Cipher;
|
||||
|
||||
constructor(options: ILocalFileDestinationProviderOptions) {
|
||||
this.options = options;
|
||||
@ -88,9 +90,10 @@ class LocalFileDestinationProvider implements IDestinationProvider {
|
||||
}
|
||||
|
||||
// Encryption
|
||||
// if (options.encryption?.enabled) {
|
||||
// streams.push(encrypt(options.encryption.key).cipher());
|
||||
// }
|
||||
if (this.options.encryption?.enabled) {
|
||||
this.cipher = createCipher(this.options.encryption.key);
|
||||
streams.push(this.cipher);
|
||||
}
|
||||
|
||||
// FS write stream
|
||||
streams.push(createMultiFilesWriteStream(filePathFactory, this.options.file.maxSize));
|
||||
|
Loading…
x
Reference in New Issue
Block a user