Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed May 21, 2023
1 parent 9588136 commit 1737c7f
Showing 1 changed file with 105 additions and 36 deletions.
141 changes: 105 additions & 36 deletions config/config.default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,84 +7,153 @@ import { SyncDeleteMode, SyncMode } from '../app/common/constants';

export const cnpmcoreConfig = {
name: 'cnpm',
/**
* enable hook or not
*/
hookEnable: false,
/**
* mac custom hooks count
*/
hooksLimit: 20,
/**
* upstream registry url
*/
sourceRegistry: 'https://registry.npmjs.org',
// upstream registry is base on `cnpmcore` or not
// if your upstream is official npm registry, please turn it off
/**
* upstream registry is base on `cnpmcore` or not
* if your upstream is official npm registry, please turn it off
*/
sourceRegistryIsCNpm: false,
/**
* sync upstream first
*/
syncUpstreamFirst: false,
// 3 mins
/**
* sync upstream timeout, default is 3mins
*/
sourceRegistrySyncTimeout: 180000,
/**
* sync task high water size, default is 100
*/
taskQueueHighWaterSize: 100,
// sync mode
// - none: don't sync npm package
// - admin: don't sync npm package,only admin can create sync task by sync contorller.
// - all: sync all npm packages
// - exist: only sync exist packages, effected when `enableCheckRecentlyUpdated` or `enableChangesStream` is enabled
/**
* sync mode
* - none: don't sync npm package
* - admin: don't sync npm package,only admin can create sync task by sync contorller.
* - all: sync all npm packages
* - exist: only sync exist packages, effected when `enableCheckRecentlyUpdated` or `enableChangesStream` is enabled
*/
syncMode: SyncMode.none,
syncDeleteMode: SyncDeleteMode.delete,
hookEnable: false,
syncPackageWorkerMaxConcurrentTasks: 10,
triggerHookWorkerMaxConcurrentTasks: 10,
createTriggerHookWorkerMaxConcurrentTasks: 10,
// stop syncing these packages in future
/**
* stop syncing these packages in future
*/
syncPackageBlockList: [] as string[],
// check recently from https://www.npmjs.com/browse/updated, if use set changesStreamRegistry to cnpmcore,
// maybe you should disable it
/**
* check recently from https://www.npmjs.com/browse/updated, if use set changesStreamRegistry to cnpmcore,
* maybe you should disable it
*/
enableCheckRecentlyUpdated: true,
// mirror binary, default is false
/**
* mirror binary, default is false
*/
enableSyncBinary: false,
// cnpmcore api: https://r.cnpmjs.org/-/binary
/**
* sync binary source api, default is `${sourceRegistry}/-/binary`
*/
syncBinaryFromAPISource: '',
// enable sync downloads data from source registry https://github.com/cnpm/cnpmcore/issues/108
// all three parameters must be configured at the same time to take effect
/**
* enable sync downloads data from source registry https://github.com/cnpm/cnpmcore/issues/108
* all three parameters must be configured at the same time to take effect
*/
enableSyncDownloadData: false,
syncDownloadDataSourceRegistry: '',
syncDownloadDataMaxDate: '', // should be YYYY-MM-DD format
// https://github.com/npm/registry-follower-tutorial
/**
* should be YYYY-MM-DD format
*/
syncDownloadDataMaxDate: '',
/**
* @see https://github.com/npm/registry-follower-tutorial
*/
enableChangesStream: false,
checkChangesStreamInterval: 500,
changesStreamRegistry: 'https://replicate.npmjs.com',
// handle _changes request mode, default is 'streaming', please set it to 'json' when on cnpmcore registry
/**
* handle _changes request mode, default is 'streaming', please set it to 'json' when on cnpmcore registry
*/
changesStreamRegistryMode: 'streaming',
/**
* registry url
*/
registry: 'http://localhost:7001',
// https://docs.npmjs.com/cli/v6/using-npm/config#always-auth npm <= 6
// if `alwaysAuth=true`, all api request required access token
/**
* https://docs.npmjs.com/cli/v6/using-npm/config#always-auth npm <= 6
* if `alwaysAuth=true`, all api request required access token
*/
alwaysAuth: false,
// white scope list
/**
* white scope list
*/
allowScopes: [
'@cnpm',
'@cnpmcore',
'@example',
],
// allow publish non-scope package, disable by default
/**
* allow publish non-scope package, disable by default
*/
allowPublishNonScopePackage: false,
// Public registration is allowed, otherwise only admins can login
/**
* Public registration is allowed, otherwise only admins can login
*/
allowPublicRegistration: true,
// default system admins
/**
* default system admins
*/
admins: {
// name: email
cnpmcore_admin: 'admin@cnpmjs.org',
},
// use webauthn for login, https://webauthn.guide/
// only support platform authenticators, browser support: https://webauthn.me/browser-support
/**
* use webauthn for login, https://webauthn.guide/
* only support platform authenticators, browser support: https://webauthn.me/browser-support
*/
enableWebAuthn: false,
// http response cache control header
/**
* http response cache control header
*/
enableCDN: false,
// if you are using CDN, can override it
// it meaning cache 300s on CDN server and client side.
/**
* if you are using CDN, can override it
* it meaning cache 300s on CDN server and client side.
*/
cdnCacheControlHeader: 'public, max-age=300',
// if you are using CDN, can set it to 'Accept, Accept-Encoding'
/**
* if you are using CDN, can set it to 'Accept, Accept-Encoding'
*/
cdnVaryHeader: 'Accept, Accept-Encoding',
// store full package version manifests data to database table(package_version_manifests), default is false
/**
* store full package version manifests data to database table(package_version_manifests), default is false
*/
enableStoreFullPackageVersionManifestsToDatabase: false,
// only support npm as client and npm >= 7.0.0 allow publish action
/**
* only support npm as client and npm >= 7.0.0 allow publish action
*/
enableNpmClientAndVersionCheck: true,
// sync when package not found, only effect when syncMode = all/exist
/**
* sync when package not found, only effect when syncMode = all/exist
*/
syncNotFound: false,
// redirect to source registry when package not found
/**
* redirect to source registry when package not found
*/
redirectNotFound: true,
// enable unpkg features, https://github.com/cnpm/cnpmcore/issues/452
/**
* enable unpkg features, https://github.com/cnpm/cnpmcore/issues/452
*/
enableUnpkg: true,
};

Expand Down

0 comments on commit 1737c7f

Please sign in to comment.