The botfile.js is located at the root of a bot project and contains all the configuration required by Botpress to operate.
Here's an overview of the variables and what they do:
dataDir
: The data directory where all your bot's data will be saved, including the built-in database file and the modules data.modulesConfigDir
: The modules configuration directory. Configuration is separate from regular data (dataDir
) because you might want to checkin configuration to source-control.disableFileLogs
: Setting to true will disable persisting logs to file system.notification.file
: The name of the files were notifications are persisted NOTE: (will be moved to the database in an upcoming version)notification.maxLength
: The maximum number of notifications to persistlog.file
: The name of the log fileslog.maxSize
: The maximum size of log fileslogin.enabled
: If login is requiredlogin.tokenExpiry
: The lifetime of an authentication token, after which clients will need to re-authenticatelogin.password
: The password required to login. NOTE: the username is alwaysadmin
as of writinglogin.maxAttempts
: The maximum amount of login attempts in thelogin.resetAfter
timelogin.resetAfter
: Resets login attempts after this time
The configuration can be accessed programmatically directly in the bp.botfile
object. For example, you may check if login is enabled by looking at bp.botfile.login.enabled
.
Since the botfile is a regular commonjs module, arbitrary code can be run in the botfile in order to compute the required fields. The exported value must always be the final configuration object and should be synchronous. You should never mutate the configuration at run time.