The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WWW::Suffit::Server - The Suffit API web-server class

SYNOPSIS

    WWW::Suffit::Server;

DESCRIPTION

This module provides API web-server functionality

OPTIONS

    sub startup {
        my $self = shift->SUPER::startup( OPTION_NAME => VALUE, ... );

        # ...
    }

List of allowed options:

all_features

    all_features => 'on'

This option enables all of the init_* options, which are described bellow

Default: off

init_authdb

    init_authdb => 'on'

This option enables AuthDB initialize

Default: off

init_api_routes

    init_api_routes => 'on'

Enable Suffit API routes

Default: off

init_rsa_keys

    init_rsa_keys => 'on'

This option enables RSA keys initialize

Default: off

config_opts

    config_opts => { ... }

This option sets WWW::Suffit::Plugin::ConfigGeneral plugin options

Default:

    `noload => 1` if $self->configobj exists
    `defaults => $self->config` if $self->config is not void

syslog_opts

    syslog_opts => { ... }

This option sets WWW::Suffit::Plugin::Syslog plugin options

Default:

    `enable => 1` if the `Log` config directive is "syslog"

ATTRIBUTES

This class implements the following attributes

cache

The Mojo::Cache object

configobj

The Config::General object or undef

datadir

The sharedstate data directory (data dir)

Default: /var/lib/<MONIKER>

debugmode

If this attribute is enabled then this server is no daemonize performs

documentroot

Document root directory

Default: /var/www/<MONIKER>

homedir

The Project home directory

Default: /usr/share/<MONIKER>

logfile

The log file

Default: /var/log/<MONIKER>.log

loglevel

This attribute performs set the log level

Default: warn

max_history_size

Maximum number of logged messages to store in "history", defaults to 25

moniker

Project name in lowercase notation, project nickname, moniker. This value often used as default filename for configuration files and the like

Default: decamelizing the application class

See "moniker" in Mojolicious

mysecret

Default secret string

Default: <DEFAULT_SECRET>

project_name

The project name. For example: MyTestApp

Default: current class name

private_key

Private RSA key

project_version

The project version. For example: 1.00

NOTE! This is required attribute!

public_key

Public RSA key

tempdir

The temp directory

Default: /tmp/<MONIKER>

trustedproxies

List of trusted proxies

Default: none

server_addr

Main listener address (host)

Default: * (::0, 0:0:0:0)

server_port

Main listener port

Default: 8080

server_url

Main listener URL

See ListenAddr and ListenPort configuration directives

Default: http://127.0.0.1:8080

METHODS

This class inherits all methods from Mojolicious and implements the following new ones

listeners

This method returns server listeners as list of URLs

    $prefork->listen($app->listeners);

raise

    $self->raise("Mask %s", "val");
    $self->raise("val");

Prints error message to STDERR and exit with errorlevel = 1

NOTE! For internal use only

reload

The reload hook

startup

Mojolicious application startup method

HELPERS

This class implements the following helpers

authdb

This is access method to the AuthDB object (state object)

jwt

This helper makes JWT object with RSA keys and returns it

token

This helper performs get of current token from HTTP Request headers

HISTORY

See Changes file

TO DO

See TODO file

SEE ALSO

Mojolicious, WWW::Suffit, WWW::Suffit::RSA, WWW::Suffit::JWT, WWW::Suffit::AuthDB

AUTHOR

Serż Minus (Sergey Lepenkov) https://www.serzik.com <abalama@cpan.org>

COPYRIGHT

Copyright (C) 1998-2023 D&D Corporation. All Rights Reserved

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See LICENSE file and https://dev.perl.org/licenses/