Sign inSign up

nhost/hasura-storage

By nhost

Updated about 1 year ago

Image
4

100K+

nhost/hasura-storage repository overview

Hasura Storage

HTTP based Storage Service


API Endpoints-
Endpoint Description
GET /healthzCheck health of service
GET /tokenGet access token.
POST /uploadUpload file, expects data in formData with "file" as field name.
GET /file/{fileID}/{fileName}Retrieve file with given pathname({fileID}/{fileName}).
GET /generate-signed-url/{fileID}/{fileName}Generate Signed URL for file.
GET /file-signed/{fileID}/{fileName}?token={token}Retrieve file using signed URL.
DELETE /deleteFile/{fileID}/{fileName}Delete a file with given pathname({fileID}/{fileName}).

All the endpoints except /healthz and /token, expect header Authorization Bearer token.

Rate Limiting is provided for upload endpoint whose values can be set in .env file.


ENV-
  • PORT - Port on which service will run.
  • DATABASE_URL - Connection URL for database.
  • S3_ACCESS_KEY - Access key for storage bucket.
  • S3_SECRET_KEY - Secret key for storage bucket.
  • S3_ENDPOINT - Endpoint to storage bucket.
  • S3_BUCKET - Name of bucket.
  • GRAPHQL_ENGINE_BASE_URL - Base URL for graphql engine server(From Hasura).
  • GRAPHQL_ENDPOINT - Graphql endpoint(From Hasura).
  • HASURA_GRAPHQL_ADMIN_SECRET - Admin Secret for Graphql(From Hasura).
  • JWT_SECRET - Secret for JWT tokens.
  • KEY - Encryption key.
  • SIGNED_URL_TTE - Expiry time in minutes for signed URL.
  • TOKEN_TTE - Expiry time in minutes for access token.
  • REQ_PER_MIN - Request Per Minute for rate limiting on downloads.
  • REQ_BURST - Number of requests that will be allowed to exceed the rate in a single burst.

How to run-
Using Docker -

Build image-

docker build -t [image_name] .

Run image-

docker run -p [port]:[port] -e DATABASE_URL=[database_url] -e S3_ACCESS_KEY=[s3_access_key] -e S3_SECRET_KEY=[s3_sercert_key] -e S3_ENDPOINT=[s3_endpoint] -e GRAPHQL_ENGINE_BASE_URL=[graphql_engine_base_url] -e GRAPHQL_ENDPOINT=[graphql_endpoint] -e HASURA_GRAPHQL_ADMIN_SECRET=[hasura_graphql_admin_secret] -e JWT_SECRET=[jwt_secret] -e KEY=[encryption_key] -e SIGNED_URL_TTE=[expiry_time_for_signed_url] -e TOKEN_TTE=[expiry_time_for_access_token] -e REQ_PER_MIN=[req_per_min] -e REQ_BURST=[req_burst] [image_name]

or

docker run -p [port]:[port] --env-file [env_file] [image_name]

Tag summary

Content type

Image

Digest

sha256:ce1b9bc55

Size

49 MB

Last updated

about 1 year ago

docker pull nhost/hasura-storage:0.8.0-beta5