Skip to content

Commit

Permalink
chore: reconfiguring for backward comp
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthakpranesh committed Mar 10, 2024
1 parent 6b001d0 commit 6d123f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ SERVER_PORT=8001

# you want to use gcp or local filesystem
# gcp -> google cloud storage, local -> local filesystem
# defaults to gcp
STORAGE_TYPE=local

# if storage type is gcp, then uncomment below and add the bucket name
# if storage type is gcp/not set, then uncomment below and add the bucket name
# defaults to "athene-diagram-files"
# STORAGE_GCP_BUCKET_NAME=athene-diagram-files
8 changes: 4 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import ShortUniqueId from 'short-unique-id';
import fileStore from './fileStore';

const uid = new ShortUniqueId({ length: 20 });

const serverPort = parseInt(process.env.SERVER_PORT || '8080');

let storageBucket: Bucket | typeof fileStore;
if (process.env.STORAGE_TYPE === "gcp") {
if (process.env.STORAGE_TYPE === "local") {
storageBucket = fileStore
} else {
const storageClient = new Storage();
storageBucket = storageClient.bucket(process.env.STORAGE_GCP_BUCKET_NAME || 'athene-diagram-files');
} else {
storageBucket = fileStore
}

const server = Server.configure({
Expand Down

0 comments on commit 6d123f7

Please sign in to comment.