Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

Backends

ComputerCandy edited this page Jun 22, 2017 · 3 revisions

PEX provides two backends: file or sql. The file backend is used by default.

The active backend can be switched "on-the-fly" without a server restart by using the pex backend command and specifying the backend to use, as defined in the backends section of the config.yml file. See Commands for further details and the permissions node.

File backend configuration (top)

All permissions info is stored in the filename specified in the file backend section of the config file.

SQL backend configuration (top)

WARNING: The SQL backend has one limitation at the time of this writing (1/2/2013). The max length of a node is 200 characters long by default. Anything longer will be truncated in the database and will not generate an error. To work around this limitation, you can:

  • Edit the SQL database to allow for longer strings (not recommended)
  • Split longer lines into separate ones that are under 200 characters

(Thanks goes to Bukkit forum member s32ialx for finding this limitation and reporting it)

SQL backend configuration nodes are inside the permissions.backend.sql node

Node Description
uri Database connection string, AKA the DSN. Please note that the DSN is driver specific. For example, MySQL would be like this: mysql://<hostname>/<database>
user Database user name. If the database doesn't require a username, this can be removed.
password Database password for specified user. If database doesn't require a password, this is optional

MySQL (top)

SQL Backend configuration example using MySQL:

permissions:
    backend: sql
    backends:
        sql:
            uri: mysql://localhost/databasename
            user: username
            password: password

Change the hostname, database name, database username and password as needed to match your configuration. In many cases, the hostname is "localhost", assuming that the database server is on the same machine as the minecraft server. Check with your server host or network/systems admin for confirmation.

PEX will automatically create the database tables and initial groups and permissions on startup if they are not already present. When ready, import data from the file backend by running the command pex import file

Do not delete the initial data if you are not 100% sure of what you are doing.

Additionally one can change the default table names with alias. Example:

permissions:
    backends:
        sql:
            uri: mysql://192.168.5.4/demo
            password: password
            user: demo
            aliases:
                permissions: pex_permissions
                permissions_inheritance: pex_inheritance
                permissions_entity: pex_entity

SQLite Backend Configuration (top)

SQLite configuration is almost the same as the SQL section, with a few differences:

You need to set permissions.backends.sql.driver to sqlite and permissions.backends.sql.uri to something like sqlite:databasename.

permissions:
    basedir: plugins/PermissionsEx
    backend: sql
    backends:
        sql:
            uri: sqlite:plugins/PermissionsEx/permissions.db
            user: username
            password: password

After server restart/reload, a file named permissions.db will be created in PermissionsEx plugin folder. Do not remove this file, it is the database file.