Skip to content
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

Enable prefix env variable #92

Closed
mxrlkn opened this issue Aug 7, 2021 · 4 comments
Closed

Enable prefix env variable #92

mxrlkn opened this issue Aug 7, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@mxrlkn
Copy link

mxrlkn commented Aug 7, 2021

I would like to have notea access s3 under a prefix. I see it's a setting here: https://github.com/QingWei-Li/notea/blob/96a71af55688fbe892ea5b7c0d76fe90e454297e/libs/server/store/index.ts#L4-L12

But it's not enabled.

Can prefix be enabled as an env variable?

@QingWei-Li
Copy link
Collaborator

Sorry, what is prefix env variable? I did not find relevant information.

@QingWei-Li QingWei-Li added the question Further information is requested label Aug 9, 2021
@mxrlkn
Copy link
Author

mxrlkn commented Aug 9, 2021

Sorry I mean environment variable.

You pass prefix to new StoreS3 with an empty string

https://github.com/QingWei-Li/notea/blob/96a71af55688fbe892ea5b7c0d76fe90e454297e/libs/server/store/index.ts#L4

https://github.com/QingWei-Li/notea/blob/96a71af55688fbe892ea5b7c0d76fe90e454297e/libs/server/store/index.ts#L12

Is it possible to be able to change prefix to something else via an environment variable?

Like this for example:

export function createStore() {
  return new StoreS3({
    accessKey: getEnv('STORE_ACCESS_KEY', undefined, true),
    secretKey: getEnv('STORE_SECRET_KEY', undefined, true),
    endPoint: getEnv('STORE_END_POINT'),
    bucket: getEnv('STORE_BUCKET', 'notea'),
    region: getEnv('STORE_REGION', 'us-east-1'),
    pathStyle: getEnv('STORE_FORCE_PATH_STYLE', false),
    prefix: getEnv('STORE_PREFIX', ''),
  })
}

Then I can have notea store the data on a specific path in S3.

@kdasme
Copy link

kdasme commented Aug 9, 2021

Hey @QingWei-Li, thank you for a great tool.

If I understand correctly, @mxrlkn is asking whether it is possible to specify S3 key as a prefix to store the data, so it wouldn't be necessary to create a dedicated bucket for Notea. I actually wanted to ask the same question. :)

@QingWei-Li QingWei-Li added enhancement New feature or request and removed question Further information is requested labels Aug 9, 2021
@mxrlkn
Copy link
Author

mxrlkn commented Aug 14, 2021

I just tested it, and it works 🎉

Thank you!

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

No branches or pull requests

3 participants