Skip to content

config

import "github.com/pzsp-teams/lib/config"

Package config holds configuration structs used across the application. Defined configs:

  • AuthConfig: holds authentication configuration.
  • SenderConfig: holds sender configuration.
  • CacheConfig: holds caching configuration.

Index

type AuthConfig

AuthConfig holds configuration for authentication. All fields are required - they are needed to acquire tokens via MSAL.

type AuthConfig struct {
    ClientID   string
    Tenant     string
    Email      string
    Scopes     []string
    AuthMethod Method
}

type CacheConfig

CacheConfig holds configuration for caching.

type CacheConfig struct {
    Mode     CacheMode
    Provider CacheProvider
    Path     *string
}

type CacheMode

CacheMode defines the caching strategy used by the application.

type CacheMode string

const (
    // CacheDisabled indicates that caching is turned off.
    CacheDisabled CacheMode = "DISABLED"

    // CacheSync indicates that cache operations are performed synchronously.
    CacheSync CacheMode = "SYNC"

    // CacheAsync indicates that cache operations are performed asynchronously.
    CacheAsync CacheMode = "ASYNC"
)

type CacheProvider

CacheProvider defines the backend used for caching.

type CacheProvider string

const (
    // CacheProviderJSONFile indicates that json-file cache is used.
    CacheProviderJSONFile CacheProvider = "JSON_FILE"
)

type Method

Method defines the authentication flow used when acquiring tokens.

type Method string

const (
    // Interactive opens a browser window for user authentication.
    Interactive Method = "INTERACTIVE"

    // DeviceCode prints a device code to the console and prompts the user to visit a URL to authenticate.
    DeviceCode Method = "DEVICE_CODE"
)

type SenderConfig

SenderConfig defines configuration for the request sender which connects with the Microsoft Graph API. MaxRetryDelay and Timeout are in seconds.

type SenderConfig struct {
    MaxRetries     int
    NextRetryDelay int
    Timeout        int
}

Generated by gomarkdoc