Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b5f53b1f64 | |||
| e5a02a014a | |||
| 9d12338630 | |||
| 3c75bfedfc |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smarts3",
|
"name": "@pushrocks/smarts3",
|
||||||
"version": "1.0.5",
|
"version": "1.0.7",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@pushrocks/smarts3",
|
"name": "@pushrocks/smarts3",
|
||||||
"version": "1.0.5",
|
"version": "1.0.7",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartfile": "^9.0.3",
|
"@pushrocks/smartfile": "^9.0.3",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smarts3",
|
"name": "@pushrocks/smarts3",
|
||||||
"version": "1.0.5",
|
"version": "1.0.7",
|
||||||
"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",
|
||||||
|
|||||||
@@ -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);
|
||||||
});
|
});
|
||||||
|
|||||||
10
ts/index.ts
10
ts/index.ts
@@ -7,6 +7,14 @@ export interface ISmarts3ContructorOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Smarts3 {
|
export class Smarts3 {
|
||||||
|
// STATIC
|
||||||
|
public static async createAndStart(optionsArg: ConstructorParameters<typeof Smarts3>[0]) {
|
||||||
|
const smartS3Instance = new Smarts3(optionsArg);
|
||||||
|
await smartS3Instance.start();
|
||||||
|
return smartS3Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// INSTANCE
|
||||||
public options: ISmarts3ContructorOptions;
|
public options: ISmarts3ContructorOptions;
|
||||||
public dataForClient = {
|
public dataForClient = {
|
||||||
s3AccessKey: 'S3RVER',
|
s3AccessKey: 'S3RVER',
|
||||||
@@ -40,7 +48,7 @@ export class Smarts3 {
|
|||||||
console.log('s3 server is running');
|
console.log('s3 server is running');
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getLocalS3Descriptor(): Promise<plugins.smartbucket.ISmartBucketConfig> {
|
public async getS3Descriptor(): Promise<plugins.smartbucket.ISmartBucketConfig> {
|
||||||
return {
|
return {
|
||||||
accessKey: this.dataForClient.s3AccessKey,
|
accessKey: this.dataForClient.s3AccessKey,
|
||||||
accessSecret: this.dataForClient.s3AccessSecret,
|
accessSecret: this.dataForClient.s3AccessSecret,
|
||||||
|
|||||||
Reference in New Issue
Block a user