mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Extracted table allowlists into a separate module
refs https://github.com/TryGhost/Team/issues/610 - Before introducing a new test for the refed issue doing a linting cleanup. The result will be removing one of `File has too many lines ` lint warnings
This commit is contained in:
parent
6d2890c1a8
commit
79439bdac5
2 changed files with 75 additions and 65 deletions
|
@ -8,71 +8,11 @@ const logging = require('../../../shared/logging');
|
|||
const errors = require('@tryghost/errors');
|
||||
const security = require('@tryghost/security');
|
||||
const models = require('../../models');
|
||||
|
||||
// NOTE: these tables can be optionally included to have full db-like export
|
||||
const BACKUP_TABLES = [
|
||||
'actions',
|
||||
'api_keys',
|
||||
'brute',
|
||||
'emails',
|
||||
'integrations',
|
||||
'invites',
|
||||
'labels',
|
||||
'members',
|
||||
'members_labels',
|
||||
'members_products',
|
||||
'members_stripe_customers',
|
||||
'members_stripe_customers_subscriptions',
|
||||
'migrations',
|
||||
'migrations_lock',
|
||||
'permissions',
|
||||
'permissions_roles',
|
||||
'permissions_users',
|
||||
'products',
|
||||
'webhooks',
|
||||
'snippets',
|
||||
'tokens',
|
||||
'sessions',
|
||||
'stripe_products',
|
||||
'stripe_prices',
|
||||
'mobiledoc_revisions',
|
||||
'email_batches',
|
||||
'email_recipients',
|
||||
'members_payment_events',
|
||||
'members_login_events',
|
||||
'members_email_change_events',
|
||||
'members_status_events',
|
||||
'members_paid_subscription_events',
|
||||
'members_subscribe_events'
|
||||
];
|
||||
|
||||
// NOTE: exposing only tables which are going to be included in a "default" export file
|
||||
// they should match with the data that is supported by the importer.
|
||||
// In the future it's best to move to resource-based exports instead of database-based ones
|
||||
const TABLES_ALLOWLIST = [
|
||||
'posts',
|
||||
'posts_authors',
|
||||
'posts_meta',
|
||||
'posts_tags',
|
||||
'roles',
|
||||
'roles_users',
|
||||
'settings',
|
||||
'tags',
|
||||
'users'
|
||||
];
|
||||
|
||||
// NOTE: these are settings keys which should never end up in the export file
|
||||
const SETTING_KEYS_BLOCKLIST = [
|
||||
'stripe_connect_publishable_key',
|
||||
'stripe_connect_secret_key',
|
||||
'stripe_connect_account_id',
|
||||
'stripe_secret_key',
|
||||
'stripe_publishable_key',
|
||||
'members_stripe_webhook_id',
|
||||
'members_stripe_webhook_secret',
|
||||
'oauth_client_id',
|
||||
'oauth_client_secret'
|
||||
];
|
||||
const {
|
||||
BACKUP_TABLES,
|
||||
TABLES_ALLOWLIST,
|
||||
SETTING_KEYS_BLOCKLIST
|
||||
} = require('./table-lists');
|
||||
|
||||
const modelOptions = {context: {internal: true}};
|
||||
|
||||
|
|
70
core/server/data/exporter/table-lists.js
Normal file
70
core/server/data/exporter/table-lists.js
Normal file
|
@ -0,0 +1,70 @@
|
|||
// NOTE: these tables can be optionally included to have full db-like export
|
||||
const BACKUP_TABLES = [
|
||||
'actions',
|
||||
'api_keys',
|
||||
'brute',
|
||||
'emails',
|
||||
'integrations',
|
||||
'invites',
|
||||
'labels',
|
||||
'members',
|
||||
'members_labels',
|
||||
'members_products',
|
||||
'members_stripe_customers',
|
||||
'members_stripe_customers_subscriptions',
|
||||
'migrations',
|
||||
'migrations_lock',
|
||||
'permissions',
|
||||
'permissions_roles',
|
||||
'permissions_users',
|
||||
'products',
|
||||
'webhooks',
|
||||
'snippets',
|
||||
'tokens',
|
||||
'sessions',
|
||||
'stripe_products',
|
||||
'stripe_prices',
|
||||
'mobiledoc_revisions',
|
||||
'email_batches',
|
||||
'email_recipients',
|
||||
'members_payment_events',
|
||||
'members_login_events',
|
||||
'members_email_change_events',
|
||||
'members_status_events',
|
||||
'members_paid_subscription_events',
|
||||
'members_subscribe_events'
|
||||
];
|
||||
|
||||
// NOTE: exposing only tables which are going to be included in a "default" export file
|
||||
// they should match with the data that is supported by the importer.
|
||||
// In the future it's best to move to resource-based exports instead of database-based ones
|
||||
const TABLES_ALLOWLIST = [
|
||||
'posts',
|
||||
'posts_authors',
|
||||
'posts_meta',
|
||||
'posts_tags',
|
||||
'roles',
|
||||
'roles_users',
|
||||
'settings',
|
||||
'tags',
|
||||
'users'
|
||||
];
|
||||
|
||||
// NOTE: these are settings keys which should never end up in the export file
|
||||
const SETTING_KEYS_BLOCKLIST = [
|
||||
'stripe_connect_publishable_key',
|
||||
'stripe_connect_secret_key',
|
||||
'stripe_connect_account_id',
|
||||
'stripe_secret_key',
|
||||
'stripe_publishable_key',
|
||||
'members_stripe_webhook_id',
|
||||
'members_stripe_webhook_secret',
|
||||
'oauth_client_id',
|
||||
'oauth_client_secret'
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
BACKUP_TABLES,
|
||||
TABLES_ALLOWLIST,
|
||||
SETTING_KEYS_BLOCKLIST
|
||||
};
|
Loading…
Reference in a new issue