Skip to content

SSA-292 - Helix-shared-storage/HelixStorage - Bucket population #1083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Brohio-Babes
Copy link
Collaborator

@Brohio-Babes Brohio-Babes commented Apr 16, 2025

Enabling variablized bucket support for helix-shared-storage/HelixStorage function. Tests validated on helix-admin and on this module:

helix admin >>> BEFORE:

1673 passing (33s)
3 pending
=============================== Coverage summary ===============================
Statements : 100% ( 27437/27437 )
Branches : 100% ( 5486/5486 )
Functions : 100% ( 747/747 )
Lines : 100% ( 27437/27437 )

helix admin >>> AFTER:

1673 passing (33s)
3 pending
=============================== Coverage summary ===============================
Statements : 100% ( 27437/27437 )
Branches : 100% ( 5486/5486 )
Functions : 100% ( 747/747 )
Lines : 100% ( 27437/27437 )

helix-shared-storage >>>BEFORE:

object uploaded to: helix-code-bus/foo
✔ can put object
43 passing (256ms)

helix-shared-storage >>> AFTER:

object uploaded to: helix-code-bus/foo
✔ can put object
45 passing (263ms)

@Brohio-Babes Brohio-Babes requested a review from tripodsan April 16, 2025 02:50
Comment on lines +620 to +623
CONTENT_BUS_BUCKET: contentBusBucket = process.env.CONTENT_BUS_BUCKET || 'helix-content-bus',
CODE_BUS_BUCKET: codeBusBucket = process.env.CODE_BUS_BUCKET || 'helix-code-bus',
MEDIA_BUS_BUCKET: mediaBusBucket = process.env.MEDIA_BUS_BUCKET || 'helix-media-bus',
CONFIG_BUS_BUCKET: configBusBucket = process.env.CONFIG_BUS_BUCKET || 'helix-config-bus',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • can we prefix those with HLX_ ?
  • why the defaults? (they are already handled later)

Copy link
Collaborator Author

@Brohio-Babes Brohio-Babes Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing.

You are saying just manage default in the methods [1] correct? (contentBus, etc).

My goal was to add context.env > process.env > hardcoded type logic. Always falling back to hardcoded so no changes are needed on your end to adopt.

[1] EXAMPLE
contentBus(disableR2 = false) { return this.bucket(process.env.CONTENT_BUS_BUCKET || 'helix-content-bus', disableR2); }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no. now you have 2 places where it defaults. here, in fromContext() and in the contentBus() etc. methods.
so remove it here.

@@ -616,6 +616,11 @@ export class HelixStorage {
CLOUDFLARE_R2_ACCESS_KEY_ID: r2AccessKeyId,
CLOUDFLARE_R2_SECRET_ACCESS_KEY: r2SecretAccessKey,
HELIX_STORAGE_DISABLE_R2: disableR2,
AWS_REGION: region = process.env.AWS_REGION || 'us-east-1',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you move this default to here?

Copy link
Collaborator Author

@Brohio-Babes Brohio-Babes Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. You are saying to just leave it where it is in constructor. Something like this right in the constructor? Potentially only leveraging what comes from opts.region and not populating it like EXAMPLE.

HERE:
region = 'us-east-1', accessKeyId, secretAccessKey,

EXAMPLE:
region = process.env.AWS_REGION || 'us-east-1', accessKeyId, secretAccessKey,

Constructor:
See Lines 668 to 676

*/
constructor(opts = {}) {
const {
region = 'us-east-1', accessKeyId, secretAccessKey,
region, accessKeyId, secretAccessKey,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you remove the default value for region here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants