Skip to content

Commit

Permalink
config: Configurability of the S3 bucket for Groups storage
Browse files Browse the repository at this point in the history
Twin motivations here:

  1. CDC may need to update this constant.
  2. We will probably eventually want to use a different bucket for our
     testing/development env (instead of a restricted subset of the
     production bucket).
  • Loading branch information
tsibley committed Oct 19, 2023
1 parent df6b21f commit b79aaaa
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,3 +289,26 @@ export const SESSION_MAX_AGE = fromEnvOrConfig("SESSION_MAX_AGE", 30 * 24 * 60 *
export const GROUPS_DATA_FILE =
process.env.GROUPS_DATA_FILE
?? path.join(__basedir, "env", (PRODUCTION ? "production" : "testing"), "groups.json");


/**
* Name of the S3 bucket to use for Nextstrain Groups storage.
*
* The layout of objects in the bucket will be like so:
*
* ${bucketName}/
* ${groupName}/
* group-logo.png
* group-overview.md
* datasets/
* ${datasetName}.json
* ${datasetName}_${sidecarType}.json
* …
* narratives/
* ${narrativeName}.md
* …
*
* @type {string}
* @default nextstrain-groups
*/
export const GROUPS_BUCKET = fromEnvOrConfig("GROUPS_BUCKET", "nextstrain-groups");
3 changes: 2 additions & 1 deletion src/sources/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import AWS from 'aws-sdk';
import { Buffer } from 'buffer';
import yamlFront from 'yaml-front-matter';
import * as authz from '../authz/index.js';
import { GROUPS_BUCKET } from '../config.js';
import { fetch } from '../fetch.js';
import { Group } from '../groups.js';
import * as utils from '../utils/index.js';
import { Source, Dataset, Narrative } from './models.js';

const S3 = new AWS.S3();

const BUCKET = "nextstrain-groups";
const BUCKET = GROUPS_BUCKET;
const DATASET_PREFIX = "datasets/";
const NARRATIVE_PREFIX = "narratives/";

Expand Down

0 comments on commit b79aaaa

Please sign in to comment.