config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package config provides configuration information of the Yordle application and helper methods for loading and saving configuration parameters.

Index

Constants

View Source
const InstanceKey = "DYNAMIC_CONFIG_INSTANCE"

InstanceKey is the key we use to store the unique DynamicConfig instance in memcache

View Source
const KindName = "DynamicConfig"

KindName is the datastore kind name

Variables

B is the build information instance

View Source
var DefaultInstance = DynamicConfig{
	AppName: "Yordle URL Shortener",
}

DefaultInstance is the default configuration with sensible default values

View Source
var Locales []string

Locales contains all supported locals

View Source
var ProjectName string

ProjectName is used for identifying of the project to the runtime.

Functions

func MustGetAsync

func MustGetAsync(ctx context.Context) <-chan *DynamicConfig

MustGetAsync is the same as MustGet except it returns a channel. This allows this method to be more easily ultilized asynchronously.

func Save

func Save(ctx context.Context, cfg *DynamicConfig) error

Save saves the dynamic config into the underlying datastore.

Types

type DynamicConfig

type DynamicConfig struct {
	AppName string

	GoogleAnalytics GoogleAnalyticsConfig
}

DynamicConfig represents dynamic configuration that can be changed at run time through the configuration screen.

func Get

func Get(ctx context.Context) (*DynamicConfig, error)

Get returns the instance of the DynamicConfig.

func MustGet

func MustGet(ctx context.Context) *DynamicConfig

MustGet returns the dynamic config instance. This function calls Get and if an error is returned, it will then return DefaultInstance.

type GoogleAnalyticsConfig

type GoogleAnalyticsConfig struct {
	Enabled    bool
	TrackingID string
}

GoogleAnalyticsConfig represents the configuration for google analytics

type LitLocalize added in v0.4.0

type LitLocalize struct {
	SourceLocale  string   `json:"sourceLocale"`
	TargetLocales []string `json:"targetLocales"`
}

Jump to

Keyboard shortcuts

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