Skip to main content

AdminForthInputConfig

Main configuration object for AdminForth

Properties

auth?

optional auth: object

Authorization module configuration

beforeLoginConfirmation?

optional beforeLoginConfirmation: BeforeLoginConfirmationFunction | BeforeLoginConfirmationFunction[]

Function or functions which will be called before user try to login. Each function will resive User object as an argument

clientIpHeader?

optional clientIpHeader: string

Client IP header name. If set, AdminForth will use this header to get client IP address. Otherwise it will use first IP address from X-Forwarded-For header. If you are using Cloudflare, set this to 'CF-Connecting-IP'. Case-insensitive.

demoCredentials?

optional demoCredentials: string

Pair of login and pass substitution for demo mode. Split by ':' ! This option is for demo purposes only, never use it for your projects

loginBackgroundImage?

optional loginBackgroundImage: string

File path to custom background image for login page Example: Place file login-background.jpg to ./custom folder and set this option:

loginBackgroundImage: '@@/login-background.jpg',

loginBackgroundPosition?

optional loginBackgroundPosition: "over" | "1/2" | "1/3" | "2/3" | "3/4" | "2/5" | "3/5"

Position of background image on login page 'over' - image will be displayed over full login page under login form '1/2' - image will be displayed on left 1/2 of login page

Default: '1/2'

loginPromptHTML?

optional loginPromptHTML: string

Any prompt to show users on login. Supports HTML.

passwordHashField

passwordHashField: string

Field name (column name) in user resource which will be used to get hash of password. Can be e.g. 'passwordHash'

rememberMeDays?

optional rememberMeDays: number

Remember me days for "Remember Me" checkbox on login page. If not set or set to null/0/undefined, "Remember Me" checkbox will not be displayed. If rememberMeDays is set, then users who check "Remember Me" will be staying logged in for this amount of days.

resourceId?

optional resourceId: string

Legacy field left for backward compatibility. Use usersResourceId instead.

userFullNameField?

optional userFullNameField: string

Optionally if your users table has a field(column) with full name, you can set it here. This field will be used to display user name in the top right corner of the admin panel.

usernameField

usernameField: string

Field name (column name) in user resource which will be used as username for searching user in database during login. Can be e.g. 'email' or 'username'

usersResourceId?

optional usersResourceId: string

Resource ID for resource which stores user table. Resource is a table in database where users will be stored and fetched from. Resources and their ids are defined in resources section of the config. In other words this setting is a reference to a table in database where users will be fetched from on login.

websocketSubscribed()?

optional websocketSubscribed: (topic, user) => void

callback which will be called after user subscribes to websocket topic

Parameters
ParameterTypeDescription
topicstringtopic on which user subscribed
userAdminUseruser object
Returns

void

websocketTopicAuth()?

optional websocketTopicAuth: (topic, user) => Promise<boolean>

Can be used to limit user access when subscribing from frontend to websocket topics.

Parameters
ParameterTypeDescription
topicstringtopic where user is trying to subscribe
userAdminUseruser object
Returns

Promise<boolean>


baseUrl?

optional baseUrl: string

If you want to Serve AdminForth from a subdirectory, e.g. on example.com/backoffice, you can specify it like:

baseUrl: '/backoffice',

customization?

optional customization: AdminForthInputConfigCustomization

Settings which allow you to customize AdminForth


dataSources

dataSources: AdminForthDataSource[]

List of data sources which will be used to fetch data for resources. Datasource is one database connection


databaseConnectors?

optional databaseConnectors: object

If you want use custom DataSource which is not supported by AdminForth yet, you can define it's class here

Index signature

[key: string]: IAdminForthDataSourceConnectorConstructor


menu: AdminForthConfigMenuItem[]

Array of left sidebar menu items which will be displayed in the admin panel. Menu items can be links to resources or custom pages. Menu items can be grouped.


resources

resources: AdminForthResourceInput[]

Array of resources which will be displayed in the admin panel. Resource represents one table or collection in database. Each resource has its own configuration.