App::Toot::Config - load and verify the config
use App::Toot::Config; my $config = App::Toot::Config->load( 'section name' );
App::Toot::Config loads settings for App::Toot.
App::Toot::Config
Reads, verifies, and returns the config.
The defined section name is required and dies if not found in the loaded config.
Returns a hashref of the loaded config for the defined section name.
To post to Mastodon, you need to provide the account's oauth credentials in the file config.ini.
config.ini
An example is provided as part of this distribution. The user running the toot script, for example through cron, will need access to the configuration file.
To set up the configuration file, copy config.ini.example into one of the following locations:
config.ini.example
$ENV{HOME}/.config/toot/config.ini
/etc/toot/config.ini
After creating the file, edit and update the values in the default section to match the account's oauth credentials.
default
[default] instance = mastodon.social username = youruser client_id = OKE98_kdno_NOTAREALCLIENTID client_secret = mkjklnv_NOTAREALCLIENTSECRET access_token = jo83_NOTAREALACCESSTOKEN
NOTE: If the $ENV{HOME}/.config/toot/ directory exists, config.ini will be loaded from there regardless of a config file in /etc/toot/.
$ENV{HOME}/.config/toot/
/etc/toot/
The following keys are required for each section:
The Mastodon server name the account belongs to.
The account name for the Mastodon server defined in instance.
instance
The client_id as provided for the username on the instance.
client_id
username
The client_secret as provided for the username on the instance.
client_secret
The access_token as provided for the username on the instance.
access_token
Multiple accounts can be configured with different sections after the default section.
[default] instance = mastodon.social username = youruser client_id = OKE98_kdno_NOTAREALCLIENTID client_secret = mkjklnv_NOTAREALCLIENTSECRET access_token = jo83_NOTAREALACCESSTOKEN [development] instance = botsin.space username = yourdeveluser client_id = Ijjkn_STILLNOTAREALCLIENTID client_secret = u7hhd_STILLNOTAREALCLIENTSECRET access_token = D873_SKILLNOTAREALACCESSTOKEN
The section name, development in the example above, can be named anything as long as it's unique with the other section names.
development
Copyright (c) 2023 Blaine Motsinger under the MIT license.
Blaine Motsinger blaine@renderorange.com
blaine@renderorange.com
To install App::Toot, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Toot
CPAN shell
perl -MCPAN -e shell install App::Toot
For more information on module installation, please visit the detailed CPAN module installation guide.