4 Commits

Author SHA1 Message Date
2293ad69e1 1.0.8 2021-12-20 18:25:55 +01:00
0a150a8a09 fix(core): update 2021-12-20 18:25:55 +01:00
b5f53b1f64 1.0.7 2021-12-20 17:06:43 +01:00
e5a02a014a fix(core): update 2021-12-20 17:06:42 +01:00
4 changed files with 16 additions and 15 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@pushrocks/smarts3", "name": "@pushrocks/smarts3",
"version": "1.0.6", "version": "1.0.8",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@pushrocks/smarts3", "name": "@pushrocks/smarts3",
"version": "1.0.6", "version": "1.0.8",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@pushrocks/smartfile": "^9.0.3", "@pushrocks/smartfile": "^9.0.3",

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smarts3", "name": "@pushrocks/smarts3",
"version": "1.0.6", "version": "1.0.8",
"private": false, "private": false,
"description": "create an s3 endpoint that maps to a local directory", "description": "create an s3 endpoint that maps to a local directory",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

@ -6,11 +6,10 @@ import * as smarts3 from '../ts/index';
let testSmarts3Instance: smarts3.Smarts3; let testSmarts3Instance: smarts3.Smarts3;
tap.test('should create a smarts3 instance and run it', async toolsArg => { tap.test('should create a smarts3 instance and run it', async toolsArg => {
testSmarts3Instance = new smarts3.Smarts3({ testSmarts3Instance = await smarts3.Smarts3.createAndStart({
port: 3000, port: 3000,
cleanSlate: true, cleanSlate: true,
}); });
await testSmarts3Instance.start();
console.log(`Let the instance run for 2 seconds`); console.log(`Let the instance run for 2 seconds`);
await toolsArg.delayFor(2000); await toolsArg.delayFor(2000);
}); });

View File

@ -7,13 +7,15 @@ export interface ISmarts3ContructorOptions {
} }
export class Smarts3 { export class Smarts3 {
public options: ISmarts3ContructorOptions; // STATIC
public dataForClient = { public static async createAndStart(optionsArg: ConstructorParameters<typeof Smarts3>[0]) {
s3AccessKey: 'S3RVER', const smartS3Instance = new Smarts3(optionsArg);
s3AccessSecret: 'S3RVER', await smartS3Instance.start();
port: 3000, return smartS3Instance;
useSsl: false
} }
// INSTANCE
public options: ISmarts3ContructorOptions;
public s3Instance: plugins.s3rver; public s3Instance: plugins.s3rver;
constructor(optionsArg: ISmarts3ContructorOptions) { constructor(optionsArg: ISmarts3ContructorOptions) {
@ -42,11 +44,11 @@ export class Smarts3 {
public async getS3Descriptor(): Promise<plugins.smartbucket.ISmartBucketConfig> { public async getS3Descriptor(): Promise<plugins.smartbucket.ISmartBucketConfig> {
return { return {
accessKey: this.dataForClient.s3AccessKey, accessKey: 'S3RVER',
accessSecret: this.dataForClient.s3AccessSecret, accessSecret: 'S3RVER',
endpoint: 'localhost', endpoint: 'localhost',
port: this.dataForClient.port, port: this.options.port,
useSsl: this.dataForClient.useSsl, useSsl: false,
} }
} }