Skip to content

Commit

Permalink
Merge pull request #2 from fleetbase/dev-v0.0.2-2
Browse files Browse the repository at this point in the history
small minor improvements
  • Loading branch information
roncodes authored Jul 19, 2024
2 parents eaaab97 + 27cad56 commit 917e994
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 29 deletions.
27 changes: 17 additions & 10 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,22 @@ class S3Database {
if (!this.config.bucket) {
throw new Error('s3 storage requires a bucket');
}
this.logger.debug({
config: JSON.stringify({
bucket: (0, getConfigValue_1.default)('AWS_BUCKET', this.config),
endpoint: (0, getConfigValue_1.default)('AWS_ENDPOINT', this.config),
region: (0, getConfigValue_1.default)('AWS_REGION', this.config),
accessKeyId: (0, getConfigValue_1.default)('AWS_ACCESS_KEY_ID', this.config),
secretAccessKey: (0, getConfigValue_1.default)('AWS_SECRET_ACCESS_KEY', this.config),
}, null, 4),
}, 'S3 ENV/CONFIG VARS: @{config}');
// this.logger.debug(
// {
// config: JSON.stringify(
// {
// bucket: getConfigValue('AWS_BUCKET', this.config),
// endpoint: getConfigValue('AWS_ENDPOINT', this.config),
// region: getConfigValue('AWS_REGION', this.config),
// accessKeyId: getConfigValue('AWS_ACCESS_KEY_ID', this.config),
// secretAccessKey: getConfigValue('AWS_SECRET_ACCESS_KEY', this.config),
// },
// null,
// 4
// ),
// },
// 'S3 ENV/CONFIG VARS: @{config}'
// );
this.config.bucket = (0, getConfigValue_1.default)('AWS_BUCKET', this.config);
this.config.keyPrefix = (0, getConfigValue_1.default)('AWS_KEY_PREFIX', this.config);
this.config.endpoint = (0, getConfigValue_1.default)('AWS_ENDPOINT', this.config);
Expand Down Expand Up @@ -189,7 +196,7 @@ class S3Database {
Bucket: bucket,
Key: `${keyPrefix}verdaccio-s3-db.json`,
}, (err, response) => {
this.logger.debug({ err: JSON.stringify(err, null, 4), response: JSON.stringify(response, null, 4) }, 's3: [_getData] Err: @{err} Response: @{response}');
// this.logger.debug({ err: JSON.stringify(err, null, 4), response: JSON.stringify(response, null, 4) }, 's3: [_getData] Err: @{err} Response: @{response}');
if (err) {
const s3Err = (0, s3Errors_1.convertS3Error)(err);
this.logger.error({ err: s3Err.message }, 's3: [_getData] err: @{err}');
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fleetbase/verdaccio-fleetbase-s3-storage",
"version": "0.0.1",
"version": "0.0.2",
"description": "AWS S3 storage implementation for Verdaccio modified for Fleetbase extensions.",
"keywords": [
"fleetbase",
Expand Down
34 changes: 17 additions & 17 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ export default class S3Database implements IPluginStorage<S3Config> {
throw new Error('s3 storage requires a bucket');
}

this.logger.debug(
{
config: JSON.stringify(
{
bucket: getConfigValue('AWS_BUCKET', this.config),
endpoint: getConfigValue('AWS_ENDPOINT', this.config),
region: getConfigValue('AWS_REGION', this.config),
accessKeyId: getConfigValue('AWS_ACCESS_KEY_ID', this.config),
secretAccessKey: getConfigValue('AWS_SECRET_ACCESS_KEY', this.config),
},
null,
4
),
},
'S3 ENV/CONFIG VARS: @{config}'
);
// this.logger.debug(
// {
// config: JSON.stringify(
// {
// bucket: getConfigValue('AWS_BUCKET', this.config),
// endpoint: getConfigValue('AWS_ENDPOINT', this.config),
// region: getConfigValue('AWS_REGION', this.config),
// accessKeyId: getConfigValue('AWS_ACCESS_KEY_ID', this.config),
// secretAccessKey: getConfigValue('AWS_SECRET_ACCESS_KEY', this.config),
// },
// null,
// 4
// ),
// },
// 'S3 ENV/CONFIG VARS: @{config}'
// );

this.config.bucket = getConfigValue('AWS_BUCKET', this.config);
this.config.keyPrefix = getConfigValue('AWS_KEY_PREFIX', this.config);
Expand Down Expand Up @@ -223,7 +223,7 @@ export default class S3Database implements IPluginStorage<S3Config> {
Key: `${keyPrefix}verdaccio-s3-db.json`,
},
(err, response) => {
this.logger.debug({ err: JSON.stringify(err, null, 4), response: JSON.stringify(response, null, 4) }, 's3: [_getData] Err: @{err} Response: @{response}');
// this.logger.debug({ err: JSON.stringify(err, null, 4), response: JSON.stringify(response, null, 4) }, 's3: [_getData] Err: @{err} Response: @{response}');
if (err) {
const s3Err: VerdaccioError = convertS3Error(err);
this.logger.error({ err: s3Err.message }, 's3: [_getData] err: @{err}');
Expand Down

0 comments on commit 917e994

Please sign in to comment.