GitLab...:Config(3pm)

πŸ’– GitLab::API::v4::Config πŸ’–

okay bestie, welcome to the manual page for GitLab::API::v4::Config, which lives in the User Contributed Perl Documentation section (3pm) and is literally just here to load your config from a file, from the environment, and/or from CLI options. three sources, one slay little module ✨


🌸 NAME 🌸

GitLab::API::v4::Config β€” load configuration from a file, environment, and/or CLI options. that's it, that's the whole job, and it does it gorgeously πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

use GitLab::API::v4;
use GitLab::API::v4::Config;

my $config = GitLab::API::v4::Config->new();
my $api = GitLab::API::v4->new( $config->args() );

look at that. clean. effortless. main character code fr fr πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so, gitlab-api-v4 uses this module to load its configuration. that's the vibe.

now here's the tea: if you're using GitLab::API::v4 directly, this module will not be automatically used. no auto-magic, bestie, it's giving "you have to ask." but you are so welcome to explicitly use it yourself, exactly like the SYNOPSIS shows. go off 🫢


✨ ARGUMENTS ✨

🌈 file

the file to load configuration from. it should hold valid JSON β€” valid, okay? we're not doing chaos JSON here. πŸ“

by default this gets set to .gitlab-api-v4-config in the current user's home directory. cozy. familiar. yours. 🏠

and if you wanna change that, you can override it with the GITLAB_API_V4_CONFIG_FILE environment variable or the --config-file=... command line argument. two doors, same room, pick your fave πŸšͺ✨


πŸ’œ ATTRIBUTES πŸ’œ

🌟 opt_args

returns a hashref of arguments derived from command line options. the supported options are:

--config_file=...
--url=...
--private-token=...
--access-token=...
--retries=...
⚠️ important lore alert: these options are read from, and removed from, @ARGV. and because of that, the arguments get saved internally and re-used for all instances of this class β€” so that there are no weird race conditions. no drama, no chaos, just cached args 😌

🌟 env_args

returns a hashref of arguments derived from environment variables. the supported environment variables are:

GITLAB_API_V4_CONFIG_FILE
GITLAB_API_V4_URL
GITLAB_API_V4_PRIVATE_TOKEN
GITLAB_API_V4_ACCESS_TOKEN
GITLAB_API_V4_RETRIES

five env vars, all yours, all iconic πŸ’š

🌟 file_args

returns a hashref of arguments gotten by decoding the JSON in the file. that's it. that's the whole method. decode and serve πŸ’…

🌟 args

returns a final, combined, hashref of arguments containing everything in opt_args, env_args, and file_args. the whole trio, together at last 🫢

and if there are any duplicate arguments? ranking time, no cap:

  1. opt_args has highest precedence β€” the queen at the top πŸ‘‘
  2. env_args is next β€” the middle child, still important 🌸
  3. and at the bottom is file_args β€” the underdog, the origin story πŸ’™

πŸ’… METHODS πŸ’…

⭐ get_options

⭐ configure

when called, this method interactively prompts the user for argument values and then encodes them as JSON and stores them in file. so you just sit there and answer questions, like a little interview but for your config 🎀✨

and the file gets chmod'ed 0600 so that only the current user may read or write to the file. privacy! boundaries! we love to see it πŸ”’πŸ’–


🫢 SUPPORT 🫢

see SUPPORT in GitLab::API::v4.


πŸ‘‘ AUTHORS πŸ‘‘

see AUTHORS in GitLab::API::v4.


πŸ“œ LICENSE πŸ“œ

see LICENSE in GitLab::API::v4.


and that's the whole page, bestie!! this one came courtesy of perl v5.36.0, dated 2023-06-13 β€” so yes she's a little vintage but she's still serving πŸ’–πŸ¦‹πŸŒΈ periodt ✨

πŸ“¦ where this page comes from