Skip to content

Commit

Permalink
Merge pull request microfeed#137 from microfeed/d1_migration
Browse files Browse the repository at this point in the history
Add D1_DATABASE_NAME variable to support d1 migration.
  • Loading branch information
wenbinf authored May 10, 2024
2 parents a54a541 + e8b795d commit 0e29382
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ env:
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
R2_PUBLIC_BUCKET: ${{ secrets.R2_PUBLIC_BUCKET || secrets.CLOUDFLARE_PROJECT_NAME }}
D1_DATABASE_NAME: ${{ secrets.D1_DATABASE_NAME }}
DEPLOYMENT_ENVIRONMENT: ${{ inputs.DEPLOYMENT_ENVIRONMENT }}
PRODUCTION_BRANCH: main
jobs:
Expand Down
2 changes: 2 additions & 0 deletions ops/generate_vars_toml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ cat << EOF > .vars.toml
R2_SECRET_ACCESS_KEY = "$R2_SECRET_ACCESS_KEY"
R2_PUBLIC_BUCKET = "$R2_PUBLIC_BUCKET"
D1_DATABASE_NAME = "$D1_DATABASE_NAME"
PRODUCTION_BRANCH = "$PRODUCTION_BRANCH"
MICROFEED_VERSION = "v1"
Expand Down
3 changes: 2 additions & 1 deletion ops/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class WranglerCmd {
}

_non_dev_db() {
return `${this.v.get('CLOUDFLARE_PROJECT_NAME')}_feed_db_${this.currentEnv}`;
return this.v.get('D1_DATABASE_NAME') ||
`${this.v.get('CLOUDFLARE_PROJECT_NAME')}_feed_db_${this.currentEnv}`;
}

createFeedDb() {
Expand Down
2 changes: 2 additions & 0 deletions ops/sync_project_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const ALLOWED_VARS = [
{name: 'R2_SECRET_ACCESS_KEY', encrypted: true, required: true},
{name: 'R2_PUBLIC_BUCKET', encrypted: true, required: false},

{name: 'D1_DATABASE_NAME', encrypted: true, required: false},

{name: 'NODE_VERSION', encrypted: false, required: false}, // Cloudflare Pages CI needs this to use the right Node version.
{name: 'MICROFEED_VERSION', encrypted: false, required: false},
];
Expand Down

0 comments on commit 0e29382

Please sign in to comment.