config

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2023 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Overview

Package config handles configuration management for the application.

Index

Constants

View Source
const (
	SLOT_IA = "ia" // Internet Archive
	SLOT_IS = "is" // archive.today
	SLOT_IP = "ip" // IPFS
	SLOT_PH = "ph" // Telegraph
	SLOT_TT = "tt" // Time Travel
	SLOT_GC = "gc" // Google Cache

	PB_SLUG = "/playback" // Identity for playback
	UNKNOWN = "unknown"
)

nolint:stylecheck

Variables

View Source
var (
	IPFSToken  = ""
	IPFSTarget = "web3storage"
)

Functions

func SlotExtra added in v0.8.0

func SlotExtra(s string) string

SlotExtra returns the extra config of wayback slot.

func SlotName

func SlotName(s string) string

SlotName returns the descriptions of the wayback service.

Types

type Options

type Options struct {
	// contains filtered or unexported fields
}

Options represents a configuration options in the application.

func NewOptions

func NewOptions() *Options

NewOptions returns Options with default values.

func (*Options) BoltPathname added in v0.12.3

func (o *Options) BoltPathname() string

BoltPathname returns filename of bolt database

func (*Options) ChromeRemoteAddr added in v0.10.2

func (o *Options) ChromeRemoteAddr() string

ChromeRemoteAddr returns the remote debugging address for Chrome/Chromium

func (*Options) DiscordBotToken added in v0.15.1

func (o *Options) DiscordBotToken() string

DiscordBotToken returns the token of Discord bot

func (*Options) DiscordChannel added in v0.15.1

func (o *Options) DiscordChannel() string

DiscordChannel returns the channel on Discord.

func (*Options) DiscordHelptext added in v0.15.1

func (o *Options) DiscordHelptext() string

DiscordHelptext returns the help text for Discord bot

func (*Options) EnabledChromeRemote added in v0.10.2

func (o *Options) EnabledChromeRemote() bool

EnabledChromeRemote returns whether enable Chrome/Chromium remote debugging for screenshot

func (*Options) EnabledMeilisearch added in v0.18.0

func (o *Options) EnabledMeilisearch() bool

EnabledMeilisearch returns whether enable meilisearch server.

func (*Options) EnabledMetrics added in v0.11.0

func (o *Options) EnabledMetrics() bool

EnabledMetrics returns true if metrics collector is enabled.

func (*Options) EnabledReduxer added in v0.13.0

func (o *Options) EnabledReduxer() bool

EnabledReduxer returns whether enable store binary file locally.

func (*Options) GitHubOwner added in v0.7.0

func (o *Options) GitHubOwner() string

GitHubOwner returns the user id of GitHub account.

func (*Options) GitHubRepo added in v0.7.0

func (o *Options) GitHubRepo() string

GitHubRepo returns the GitHub repository which to publish results.

func (*Options) GitHubToken added in v0.7.0

func (o *Options) GitHubToken() string

GitHubToken returns the personal access token of GitHub account.

func (*Options) HasDebugMode

func (o *Options) HasDebugMode() bool

HasDebugMode returns true if debug mode is enabled.

func (*Options) IPFSApikey added in v0.17.0

func (o *Options) IPFSApikey() string

IPFSApiKey returns the apikey of the IPFS pinning service. It returns a managed IPFS credential if env `WAYBACK_IPFS_APIKEY` empty.

func (*Options) IPFSHost

func (o *Options) IPFSHost() string

IPFSHost returns the host of IPFS daemon service.

func (*Options) IPFSMode

func (o *Options) IPFSMode() string

IPFSMode returns the mode to using IPFS.

func (*Options) IPFSPort

func (o *Options) IPFSPort() int

IPFSPort returns the port of IPFS daemon service.

func (*Options) IPFSSecret added in v0.17.0

func (o *Options) IPFSSecret() string

IPFSSecret returns the secret of the IPFS pinning service.

func (*Options) IPFSTarget added in v0.17.0

func (o *Options) IPFSTarget() string

IPFSTarget returns which IPFS pinning service to use.

func (*Options) IRCChannel added in v0.9.0

func (o *Options) IRCChannel() string

IRCChannel returns channel of IRC

func (*Options) IRCNick added in v0.9.0

func (o *Options) IRCNick() string

IRCNick returns nick of IRC

func (*Options) IRCPassword added in v0.9.0

func (o *Options) IRCPassword() string

IRCPassword returns password of IRC

func (*Options) IRCServer added in v0.9.0

func (o *Options) IRCServer() string

IRCServer returns server of IRC

func (*Options) ListenAddr added in v0.16.0

func (o *Options) ListenAddr() string

ListenAddr returns the listen address for the HTTP server.

func (*Options) LogLevel added in v0.14.1

func (o *Options) LogLevel() logger.LogLevel

LogLevel returns if the log level.

func (*Options) LogTime

func (o *Options) LogTime() bool

LogTime returns if the time should be displayed in log messages.

func (*Options) MastodonAccessToken added in v0.8.0

func (o *Options) MastodonAccessToken() string

MastodonAccessToken returns the access token of Mastodon application.

func (*Options) MastodonClientKey added in v0.8.0

func (o *Options) MastodonClientKey() string

MastodonClientKey returns the client key of Mastodon application.

func (*Options) MastodonClientSecret added in v0.8.0

func (o *Options) MastodonClientSecret() string

MastodonClientSecret returns the cilent secret of Mastodon application.

func (*Options) MastodonServer added in v0.8.0

func (o *Options) MastodonServer() string

MastodonServer returns the domain of Mastodon instance.

func (*Options) MatrixHomeserver added in v0.9.0

func (o *Options) MatrixHomeserver() string

MatrixHomeserver returns the homeserver of Matrix.

func (*Options) MatrixPassword added in v0.9.0

func (o *Options) MatrixPassword() string

MatrixPassword returns the password of Matrix account.

func (*Options) MatrixRoomID added in v0.9.0

func (o *Options) MatrixRoomID() string

MatrixRoomID returns the room ID of Matrix account.

func (*Options) MatrixUserID added in v0.9.0

func (o *Options) MatrixUserID() string

MatrixUserID returns the user ID of Matrix account.

func (*Options) MaxAttachSize added in v0.15.1

func (o *Options) MaxAttachSize(scope string) int64

MaxAttachSize returns max attach size limits for several services. scope: telegram

func (*Options) MaxMediaSize added in v0.15.1

func (o *Options) MaxMediaSize() uint64

MaxMediaSize returns max size to limit download stream media.

func (*Options) NostrPrivateKey added in v0.19.0

func (o *Options) NostrPrivateKey() string

NostrPrivateKey returns the private key of Nostr account.

func (*Options) NostrRelayURL added in v0.19.0

func (o *Options) NostrRelayURL() []string

NostrRelayURL returns the relay url of Nostr server.

func (*Options) NotionDatabaseID added in v0.18.0

func (o *Options) NotionDatabaseID() string

NotionDatabaseID returns the Notion's dabase id.

func (*Options) NotionToken added in v0.18.0

func (o *Options) NotionToken() string

NotionToken returns the Notion integration token.

func (*Options) PoolingSize added in v0.12.0

func (o *Options) PoolingSize() int

PoolingSize returns the number of worker pool

func (*Options) PublishToChannel added in v0.7.0

func (o *Options) PublishToChannel() bool

PublishToChannel returns whether to publish results to Telegram Channel.

func (*Options) PublishToDiscordChannel added in v0.15.1

func (o *Options) PublishToDiscordChannel() bool

PublishToDiscordChannel returns whether publish results to Discord channel.

func (*Options) PublishToIRCChannel added in v0.9.0

func (o *Options) PublishToIRCChannel() bool

PublishToIRCChannel returns whether publish results to IRC channel.

func (*Options) PublishToIssues added in v0.7.0

func (o *Options) PublishToIssues() bool

PublishToIssues returns whether to publish results to GitHub issues.

func (*Options) PublishToMastodon added in v0.8.0

func (o *Options) PublishToMastodon() bool

PublishToMastodon returns whether to publish result to Mastodon.

func (*Options) PublishToMatrixRoom added in v0.9.0

func (o *Options) PublishToMatrixRoom() bool

PublishToMatrixRoom returns whether publish results to Matrix room.

func (*Options) PublishToNostr added in v0.19.0

func (o *Options) PublishToNostr() bool

PublishToNostr determines whether the results should be published on Nostr.

func (*Options) PublishToNotion added in v0.18.0

func (o *Options) PublishToNotion() bool

PublishToNotion determines whether the results should be published on Notion.

func (*Options) PublishToSlackChannel added in v0.15.1

func (o *Options) PublishToSlackChannel() bool

PublishToSlackChannel returns whether publish results to Slack channel.

func (*Options) PublishToTwitter added in v0.8.0

func (o *Options) PublishToTwitter() bool

PublishToTwitter returns whether to publish result to Twitter.

func (*Options) SlackAppToken added in v0.15.1

func (o *Options) SlackAppToken() string

SlackAppToken returns the app-level token of Slack bot.

func (*Options) SlackBotToken added in v0.15.1

func (o *Options) SlackBotToken() string

SlackBotToken returns the bot user auth token of Slack bot.

func (*Options) SlackChannel added in v0.15.1

func (o *Options) SlackChannel() string

SlackChannel returns the Slack channel id.

func (*Options) SlackHelptext added in v0.15.1

func (o *Options) SlackHelptext() string

SlackHelptext returns the help text for Slack bot.

func (*Options) Slots

func (o *Options) Slots() map[string]bool

Slots returns configurations of wayback service, e.g. Internet Archive

func (*Options) StorageDir added in v0.13.0

func (o *Options) StorageDir() string

StorageDir returns the directory to storage binary file, e.g. html file, PDF

func (*Options) TelegramChannel

func (o *Options) TelegramChannel() string

TelegramChannel returns the Telegram Channel name.

func (*Options) TelegramHelptext added in v0.10.0

func (o *Options) TelegramHelptext() string

TelegramHelptext returns the help text for Telegram bot.

func (*Options) TelegramToken

func (o *Options) TelegramToken() string

TelegramToken returns the token of Telegram Bot.

func (*Options) TorLocalPort

func (o *Options) TorLocalPort() int

TorLocalPort returns the local port to a TCP listener on. This is ignored if `WAYBACK_LISTEN_ADDR` is set.

func (*Options) TorPrivKey

func (o *Options) TorPrivKey() string

TorPrivKey returns the private key of Tor service.

func (*Options) TorRemotePorts

func (o *Options) TorRemotePorts() []int

TorRemotePorts returns the remote ports to serve the Tor hidden service on.

func (*Options) TwitterAccessSecret added in v0.8.0

func (o *Options) TwitterAccessSecret() string

TwitterAccessSecret returns the access secret of Twitter application.

func (*Options) TwitterAccessToken added in v0.8.0

func (o *Options) TwitterAccessToken() string

TwitterAccessToken returns the access token of Twitter application.

func (*Options) TwitterConsumerKey added in v0.8.0

func (o *Options) TwitterConsumerKey() string

TwitterConsumerKey returns the consumer key of Twitter application.

func (*Options) TwitterConsumerSecret added in v0.8.0

func (o *Options) TwitterConsumerSecret() string

TwitterConsumerSecret returns the consumer secret of Twitter application.

func (*Options) UseTor

func (o *Options) UseTor() bool

UseTor returns whether to use the Tor proxy when snapshot webpage.

func (*Options) WaybackFallback added in v0.16.2

func (o *Options) WaybackFallback() bool

WaybackFallback returns whether fallback to Google cache is enabled if the original webpage is unavailable.

func (*Options) WaybackMaxRetries added in v0.18.0

func (o *Options) WaybackMaxRetries() uint64

WaybackMaxRetries returns max retries for a wayback request.

func (*Options) WaybackMeiliApikey added in v0.18.0

func (o *Options) WaybackMeiliApikey() string

WaybackMeiliApikey returns the Meilisearch admin apikey.

func (*Options) WaybackMeiliEndpoint added in v0.18.0

func (o *Options) WaybackMeiliEndpoint() string

WaybackMeiliEndpoint returns the Meilisearch API endpoint.

func (*Options) WaybackMeiliIndexing added in v0.18.0

func (o *Options) WaybackMeiliIndexing() string

WaybackMeiliIndexing returns the Meilisearch indexing name.

func (*Options) WaybackTimeout added in v0.16.0

func (o *Options) WaybackTimeout() time.Duration

WaybackTimeout returns timeout for a wayback request.

func (*Options) WaybackUserAgent added in v0.16.2

func (o *Options) WaybackUserAgent() string

WaybackUserAgent returns User-Agent for a wayback request.

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser handles configuration parsing.

func NewParser

func NewParser() *Parser

NewParser returns a new Parser.

func (*Parser) ParseEnvironmentVariables

func (p *Parser) ParseEnvironmentVariables() (*Options, error)

ParseEnvironmentVariables loads configuration values from environment variables.

func (*Parser) ParseFile added in v0.10.0

func (p *Parser) ParseFile(filename string) (*Options, error)

ParseFile loads configuration values from a local file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL