Skip to content
This repository has been archived by the owner on Mar 23, 2020. It is now read-only.

Config Run Through

Nathan Fiscaletti edited this page Jul 18, 2018 · 23 revisions

All Synful configuration files are stored in the config/ folder.


Custom Configurations

You can add more configuration files as custom configs using JSON files. When you add a custom configuration file, you can access it using sf_conf('filename.path.to.var');. The filename part of the path needs to be all lower case.

Exampe

config/Users.json

{
    "john": {
        "name": "John",
        "nicknames": [
            {
                "nick_id": 0,
                "readable": "Johnny"
            }
        ]
    }
}

Accessing the config

echo 'Name: '.sf_conf('users.john.name').PHP_EOL;
echo 'Readable Nickname: '.sf_conf('users.john.nicknames.0.readable').PHP_EOL;

Synful Configurations

CommandLine.json

Setting Effect
commands A list of classes that should be registered in the System as commands.

RequestHandlers.json

Setting Effect
registered A list of classes that should be registered in the System as RequestHandlers.

System.json

Setting Effect
color If set to true, the system will enable console color codes when runnin in Standalone mode.
production If set to true, line numbers and file names will not be output with error messages.
display_errors If set to true, fatal errors will be displayed.
pretty_responses If set to true, JSON responses will be formatted using JSON_PRETTY_PRINT.
allow_pretty_responses_on_get If set to true, JSON responses will be formatted using JSON_PRETTY_PRINT when the pretty $_GET parameter is passed.
global_middleware An array of the global middleware to apply to all requests.
serializer The default serializer to apply to all requests
cors_enabled If set to true, cross origin resources sharing will be enabled. (See CORS)
cors_domains The domains allowed to use cross origin resource sharing.

Rate.json

(See Rate Limiting)

Setting Effect
global If set to true, rate limiting will be applied on a global scale using the global_rate_limit.
per_key If set to true, rate limiting will be applied on a per-API Key basis.
per_handler If set to true, rate limiting will be applied on a per-Request Handler basis.
global_rate_limit.requests The number of requests you can send per global_rate_limit.per_seconds.
global_rate_limit.per_seconds The number of seconds to apply as a rate to global_rate_limit.requests.

Databases.json

See Database Management