Skip to main content

Configuration

There are three main sources of Perfsee runtime configuration: configuration files, environment variables and database, they will be loaded in order, and the later loaded data will override the previous configuration.

  1. Load the default configuration in ./packages/platform-server/src/config/default.ts
  2. Load the custom configuration in ./packages/platform-server/src/perfsee.config.ts
  3. Load environment variables, according to the definition in packages/platform-server/src/perfsee.env.ts to override the configuration
  4. Load the configuration in the ApplicationSetting table of the database

Modify configuration

Add configuration item

If you need to add a configuration item, you should declare its type in ./packages/platform-server/src/config/def.ts and add detailed configuration instructions and usage examples.

// example
export interface PerfseeConfig {
/**
* new config used for xxx
*/
newConfig: {
/**
* config field
*
* @default 'default value'
* @env PERFSEE_NEW_CONFIG_FIELD
* @see https://docs.for.such.config
*/
field: string
}
}

Modify configuration file

The configuration file is located at ./packages/platform-server/src/perfsee.config.ts, you can modify the configuration according to your needs.

caution

The modification of the configuration file takes effect after the service is restarted

perfsee.newConfig = {
field: 'new value',
}

Modify configuration in Database

We provide an admin interface where you can modify the configuration stored in the database, and the modified configuration will be saved to the database and take effect immediately.

Configuration item description

Basic configuration

Config nameTypeEnvironment variableDefault valueDescription
secretstringPERFSEE_SERVER_SECRETEncryption key used to encrypt cookies, tokens, etc.
httpsbooleanPERFSEE_SERVER_HTTPSfalseWhether to enable https
hoststringPERFSEE_SERVER_HOSTlocalhostThe domain name where the server is deployed
portnumberPERFSEE_SERVER_PORT3000The port where the server is listening
pathstringPERFSEE_SERVER_SUB_PATH''(empty)The subpath where the server is deployed, if not deployed in the root path, this item needs to be set
// example
perfsee.https = true
perfsee.host = 'perfsee.com'

MySQL

All MySQL configurations are set in the perfsee.mysql object.

Config nameTypeEnvironment variableDefault valueDescription
mysql.hoststringMYSQL_HOSTlocalhostDatabase address
mysql.portnumberMYSQL_PORT3306Database port
mysql.usernamestringMYSQL_USERNAMErootDatabase username
mysql.passwordstringMYSQL_PASSWORDrootDatabase password
mysql.databasestringMYSQL_DATABASEperfseeDatabase name
mysql.urlstringMYSQL_URLDatabase connection address, if this item is set, other database configuration will be ignored
// example
perfsee.mysql = {
host: 'localhost',
port: 3306,
username: 'root',
password: 'root',
database: 'perfsee',
}
// or
perfsee.mysql = {
url: 'mysql://root:root@localhost:3306/perfsee',
}

More MySQL-related configurations can be found in TypeORM documentation.

Redis

All Redis configurations are set in the perfsee.redis object.

Config nameTypeEnvironment variableDefault valueDescription
redis.hoststringREDIS_HOSTlocalhostRedis address
redis.portnumberREDIS_PORT6379Redis port
redis.passwordstringREDIS_PASSWORDRedis connection password
redis.dbnumberREDIS_DB0Redis database
// example
perfsee.redis = {
host: 'localhost',
port: 6379,
password: '',
db: 0,
}

More Redis-related configurations can be found in ioredis documentation.

GraphQL

All GraphQL configurations are set in the perfsee.graphql object.

Config nameTypeEnvironment variableDefault valueDescription
graphql.debugbooleantrueWhether to enable GraphQL debug mode
graphql.playgroundboolean | objecttrueWhether to enable GraphQL playground
graphql.pathstring/graphqlThe path where the GraphQL endpoint service is located
// example
perfsee.graphql = {
debug: false,
playground: true,
}

More GraphQL configurations can be found in Apollo Server documentation.

Email

All email configurations are set in the perfsee.email object.

Config nameTypeEnvironment variableDefault valueDescription
email.enablebooleanEMAIL_ENABLEfalseWhether to enable email service
email.smtp.hoststringEMAIL_SMTP_HOSTEmail service address
email.smtp.portnumberEMAIL_SMTP_PORTEmail service port
email.smtp.securebooleanEMAIL_SMTP_SECUREWhether to enable SSL for email service
email.smtp.auth.userstringEMAIL_SMTP_AUTH_USEREmail service username
email.smtp.auth.passstringEMAIL_SMTP_AUTH_PASSEmail service password
email.from.namestringEMAIL_FROM_NAMEEmail sender name
email.from.addressstringEMAIL_FROM_ADDRESSEmail sender address
// example
perfsee.email.enable = true
perfsee.email.smtp = {
host: 'smtp.example.com',
port: 465,
secure: true,
auth: {
user: 'username',
pass: 'password',
},
}
perfsee.email.from = {
name: 'Perfsee',
address: 'no-reply@perfsee.com',
}

Object Storage

All object storage configurations are set in the perfsee.objectStorage object.

Config nameTypeEnvironment variableDefault valueDescription
objectStorage.enablebooleanfalseWhether to enable object storage, false means only use local temporary storage
objectStorage.artifactobject{}Object storage configuration for storing analysis reports
objectStorage.jobLogobjectObject storage configuration for storing analysis log files. Leave it blank to use objectStorage.artifact to store logs
// example
perfsee.objectStorage.artifact = {
provider: 'aws',
region: 'eu-west-1',
aws_access_key_id: '',
aws_secret_access_key: '',
aws_s3_bucket: '',
aws_s3_endpoint: '',
// other aws storage perfsee...
}
// If you don't need to store logs separately, you can leave it empty
perfsee.objectStorage.jobLog = {
provider: 'aws',
region: 'eu-west-1',
aws_access_key_id: '',
aws_secret_access_key: '',
aws_s3_bucket: '',
aws_s3_endpoint: '',
// other aws storage perfsee...
}

Auth

All Auth configurations are set in the perfsee.auth object.

Config nameTypeEnvironment variableDefault valueDescription
auth.enableSignupbooleantrueWhether to allow users to register directly
auth.enableOauthbooleanfalseWhether to allow users to log in with third-party accounts
auth.oauthProvidersobjectThird-party login configuration
auth.adminobjectDefault administrator account configuration
// example
perfsee.auth.enableSignup = true
perfsee.auth.enableOauth = true
perfsee.auth.oauthProviders = {
github: {
clientId: 'xxx',
clientSecret: 'xxx',
args: {
scope: ['user'],
response_type: 'user',
},
},
}
perfsee.auth.admin = {
email: 'admin@perfsee.com',
password: 'xxx',
}

Project

All project configurations are set in the perfsee.project object.

Config nameTypeEnvironment variableDefault valueDescription
project.enableCreatebooleantrueWhether to allow users to create projects directly
project.enableDeletebooleantrueWhether to allow users to delete projects
project.enableImportbooleanfalseWhether to allow users to import projects from third-party repositories
project.externalProvidersArray['github']Allowed third-party repository types
// example
perfsee.project = {
enableCreate: true,
enableDelete: true,
enableImport: true,
externalProviders: ['github'],
}

Job

All job configurations are set in the perfsee.job object.

Config nameTypeEnvironment variableDefault valueDescription
job.pollingLimitnumber10Maximum number of tasks processed by each instance at the same time
job.pollingQueueLimitnumber10Maximum length of the task request waiting queue for each instance
job.pollingTimeoutSecnumber5Task request timeout time
job.executionTimeoutSecnumber1800Task execution timeout time
job.defaultZonestring'China'Default task region
job.zonesstring[]['China']All task available regions
// example
perfsee.job = {
pollingLimit: 10,
pollingQueueLimit: 10,
pollingTimeoutSec: 5,
executionTimeoutSec: 1800,
defaultZone: 'China',
zones: ['China'],
}

Runner

All Runner configurations are set in the perfsee.runner object.

Config nameTypeEnvironment variableDefault valueDescription
runner.validateRegistrationTokenbooleantrueWhether to verify the Token when registering a Runner
// example
// Disable Token verification when registering a Runner in development mode
perfsee.runner.validateRegistrationToken = perfsee.env !== 'development'

Integration

All integration configurations are set in the perfsee.integration object.

GitHub Bot

Github integration configurations, used to provide Github Bot functions such as project import and PR check.

// example
perfsee.integration.github = {
enable: true,
appName: 'perfsee',
appId: 'xxx',
privateKeyFile: '/path/to/bot/private.key',
}