Project settings
Set query defaults, week start and query cache limits in .anfra/config.yml
.anfra/config.yml holds the project's settings. Commit it, so everyone who runs the project gets the same answers. It never holds credentials. anfra init creates it with every setting at its default.
org:
url: https://us.anfra.ai/o/acme
apps:
allow_origins:
- https://cdn.acme.com
query:
default:
input:
timezone: Asia/Ho_Chi_Minh
weekStartDay: sunday
cache:
duration: 5m
locked_defaults:
- input.weekStartDay
cache:
max_duration: 24hanfra reads the file strictly. A key or value it doesn't know fails every query with repo_settings_invalid, naming the line, rather than running with defaults you didn't mean.
anfra serve reads the query settings when it starts. Restart it after changing them.
Settings
| Setting | Default | Does |
|---|---|---|
org.url | none | The organization anfra publish sends to. See Publish to anfra BI. |
apps.allow_origins | none | Extra origins data apps may load from. See Allowing another origin. |
apps.plugins.<name>.enabled | true | false leaves the plugin <name> out of the project's data apps. <name> is inspect, lineage, view-underlying-data, render or export. anfra serve applies it on the next page load. See Turning a plugin off. |
query.default.input.timezone | Etc/UTC | The IANA time zone for relative dates and date truncation, for a query that sets none. |
query.default.input.weekStartDay | monday | The day weeks start on, monday to sunday, for a query that sets none. It applies to grouping by week, dates such as this week, and day-of-week numbers. |
query.default.cache.duration | none | The cache duration for every query that sets none, such as 5m. See Query cache. |
query.locked_defaults | none | Defaults a query can't change: input.timezone, input.weekStartDay or cache.duration. Each must be set under query.default. A query that sends another value fails with an error naming the locked value. |
query.cache.enabled | true | false turns the query cache off for the project. |
query.cache.max_duration | 168h | The longest a result may be cached, from 1s to 168h. A query that asks for longer fails with an error naming the cap. A query.default.cache.duration over it is an error in the file. |
Week start
Weeks start on Monday on every database unless you set another day. Before anfra 0.21, MySQL, BigQuery and other databases whose own week starts on Sunday grouped weeks from Sunday. To keep Sunday weeks:
query:
default:
input:
weekStartDay: sundayA data app can set its own with weekStartDay, and one CLI query with --input.week-start-day.