Documentation ¶
Overview ¶
Package gaeconfig implements LUCI-config service bindings backed by AppEngine storage and caching.
Importing this module registers ${appid} and ${config_service_appid} config placeholder variables, see go.chromium.org/luci/config/vars.
DEPRECATED!
Do not use outside of GAEv1. Use go.chromium.org/luci/config/server/cfgmodule on GAEv2 and GKE instead.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigServiceAppID ¶
GetConfigServiceAppID looks up the app ID of the LUCI Config service, as set in the app's settings.
Returns an empty string if the LUCI Config integration is not configured for the app.
func RegisterVars ¶
RegisterVars registers placeholders that can be used in config set names.
Registers:
${appid} - expands into a GAE app ID of the running service. ${config_service_appid} - expands into a GAE app ID of a LUCI Config service that the running service is using (or empty string if unconfigured).
This function is called during init() with the default var set.
func Use ¶
Use installs the default luci-config client.
The client is configured to use luci-config URL specified in the settings, using GAE app service account for authentication.
If running in prod, and the settings don't specify luci-config URL, produces an implementation that returns a "not configured" error from all methods.
If running on devserver, and the settings don't specify luci-config URL, returns a filesystem-based implementation that reads configs from a directory (or a symlink) named 'devcfg' located in the GAE module directory (where app.yaml is) or its immediate parent directory.
If such directory can not be located, produces an implementation of that returns errors from all methods.
Panics if it can't load the settings (should not happen since they are in the local memory cache usually).
Types ¶
type Settings ¶
type Settings struct { // ConfigServiceHost is host name (and port) of the luci-config service to // fetch configs from. // // For legacy reasons, the JSON value is "config_service_url". ConfigServiceHost string `json:"config_service_url"` // Administrators is the auth group of users that can call the validation // endpoint. AdministratorsGroup string `json:"administrators_group"` }
Settings are stored in the datastore via appengine/gaesettings package.
func DefaultSettings ¶
DefaultSettings returns Settings to use if setting store is empty.
func FetchCachedSettings ¶
FetchCachedSettings fetches Settings from the settings store.
Uses in-process global cache to avoid hitting datastore often. The cache expiration time is 1 min (see gaesettings.expirationTime), meaning the instance will refetch settings once a minute (blocking only one unlucky request to do so).
Returns errors only if there's no cached value (i.e. it is the first call to this function in this process ever) and datastore operation fails.