NAME

Ubic::Settings - ubic settings

VERSION

version 1.60

SYNOPSIS

    my $service_dir = Ubic::Settings->service_dir;
    my $data_dir = Ubic::Settings->data_dir;
    my $default_user = Ubic::Settings->default_user;

    Ubic::Settings->data_dir($new_dir);

DESCRIPTION

This module can be used to get common ubic settings: service_dir, data_dir and default_user.

Note that these settings are global and used by ubic core. Services don't have to use data_dir to store their data, for example; they can use any dir they want.

Settings are determined in the following order (from the most priority to the least):

  • Overrides via data_dir(), service_dir() and default_user() methods.

  • Environment variables UBIC_SERVICE_DIR, UBIC_DIR and UBIC_DEFAULT_USER (which affect accordingly service_dir, data_dir and default_user);

  • Config file at ~/.ubic.cfg, /etc/ubic/ubic.cfg or /usr/local/etc/ubic/ubic.cfg, in this order;

  • If none of these settings are set, it will fail and advice to run ubic-admin setup.

METHODS

If any of setting methods is called with new value, this value will be applied for current process only.

They also will be propagated to future child processes via environment variables.

service_dir()
service_dir($dir)

Get or set directory with service descriptions.

data_dir()
data_dir($dir)

Get or set directory into which ubic stores all of its data (locks, status files, tmp files).

default_user()
default_user($user)

Get or set user for services which don't specify user themselves.

check_settings()

Check if all settings are valid.

Will throw an exception if any configuration options are not set.

AUTHOR

Vyacheslav Matyukhin <mmcleric@yandex-team.ru>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Yandex LLC.

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