Skip to content
Nick Worden edited this page Mar 20, 2019 · 4 revisions

Person Finder has a concept of config which is key-value store to configure the app and repositories.

There are two types of config; global (repository independent) config and per-repository config.

A key must be a string. A value can be in any types supported by JSON.

Read/write configs in the admin page

Most of the configs are editable as "Global settings" and "Repository settings" in the admin page (/global/admin). But some configs are only configurable via command line (see below), or only updated programatically in the code (see below).

Read/write configs in command line

For Person Finder running locally:

$ ./tools/console localhost:8000
config.get("global_conf_name")
config.set(global_conf_name="conf_value")
config.get_for_repo("japan", "per_repo_conf_name")
config.set_for_repo("japan", per_repo_conf_name="conf_value")

For Person Finder running on AppEngine:

$ ./tools/console my-app-id.appspot.com
config.get("global_conf_name")
config.set(global_conf_name="conf_value")
config.get_for_repo("japan", "per_repo_conf_name")
config.set_for_repo("japan", per_repo_conf_name="conf_value")

Read/write configs programatically:

For calls from within handlers (or anywhere else a Configuration object is available), prefer using the Configuration object's get function as it's more efficient. Otherwise, use the config module:

import config

config.get("global_conf_name")
config.set(global_conf_name="conf_value")
config.get_for_repo("japan", "per_repo_conf_name")
config.set_for_repo("japan", per_repo_conf_name="conf_value")

List of configs

Unfortunately there is no canonical place which lists all configs used in Person Finder currently.

Look up inside app/resources/admin.html.template for those availabe in the admin page.

These are configs you need to configure from the command line:

Config name Type Description
enable_sms_record_input global Optional. Set this to True to allow to add a person record via SMS. SMS support is currently only available for google.org/personfinder.
jp_mobile_carrier_redirect global Optional. Redirects phone number searches to mobile carrier sites in Japan. Set this to False unless you are running google.org/personfinder.
ping_sitemap_indexers global Optional, defaults to False. Ping search engine indexers with a sitemap when a repo is created or edited.

There are also some configs only used internally in code. You can only find them in code.

Implementation

app/config.py

Clone this wiki locally