mirror of
https://github.com/strapi/strapi.git
synced 2025-09-27 01:09:49 +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 { Duplex } from 'stream';
|
||||||
import { chain, Writable } from 'stream-chain';
|
import { chain, Writable } from 'stream-chain';
|
||||||
import { stringer } from 'stream-json/jsonl/Stringer';
|
import { stringer } from 'stream-json/jsonl/Stringer';
|
||||||
|
import type { Cipher } from 'crypto';
|
||||||
|
|
||||||
import type { IDestinationProvider, ProviderType, Stream } from '../../types';
|
import type { IDestinationProvider, ProviderType, Stream } from '../../types';
|
||||||
// import { encrypt } from '../encryption';
|
import { createCipher } from '../encryption/encrypt';
|
||||||
|
|
||||||
export interface ILocalFileDestinationProviderOptions {
|
export interface ILocalFileDestinationProviderOptions {
|
||||||
// Encryption
|
// Encryption
|
||||||
@ -37,6 +38,7 @@ class LocalFileDestinationProvider implements IDestinationProvider {
|
|||||||
name: string = 'destination::local-file';
|
name: string = 'destination::local-file';
|
||||||
type: ProviderType = 'destination';
|
type: ProviderType = 'destination';
|
||||||
options: ILocalFileDestinationProviderOptions;
|
options: ILocalFileDestinationProviderOptions;
|
||||||
|
cipher?: Cipher;
|
||||||
|
|
||||||
constructor(options: ILocalFileDestinationProviderOptions) {
|
constructor(options: ILocalFileDestinationProviderOptions) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
@ -88,9 +90,10 @@ class LocalFileDestinationProvider implements IDestinationProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Encryption
|
// Encryption
|
||||||
// if (options.encryption?.enabled) {
|
if (this.options.encryption?.enabled) {
|
||||||
// streams.push(encrypt(options.encryption.key).cipher());
|
this.cipher = createCipher(this.options.encryption.key);
|
||||||
// }
|
streams.push(this.cipher);
|
||||||
|
}
|
||||||
|
|
||||||
// FS write stream
|
// FS write stream
|
||||||
streams.push(createMultiFilesWriteStream(filePathFactory, this.options.file.maxSize));
|
streams.push(createMultiFilesWriteStream(filePathFactory, this.options.file.maxSize));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user