Documentation
¶
Overview ¶
Package config reads the app's settings: named text values that the permission list declares and the runner supplies, such as the address of a team or the day a report goes out:
settings: [team_address, report_day]
String returns the value of a setting; one the permission list does not declare is E-MAN-001. The values arrive when the app starts and stay the same until it starts again. In aicoded dev they come from the developer's dev.yaml, and an app that lacks one does not start (E-DEV-003). A password or a key is never a setting: declare it as a secret and read it with package secrets.
Read more in the guide docs/guides/settings-and-secrets.md, which aicoded explain and the MCP tool howto print as guides/settings-and-secrets.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func String ¶
String returns the value of setting name.
Example ¶
Read a setting where it is used. The permission list declares it with settings: [team_address], and its local value lives in dev.yaml.
package main
import (
"context"
"aicoded.dev/framework/config"
"aicoded.dev/framework/mailer"
)
func main() {
process := func(ctx context.Context) error {
team, err := config.String(ctx, "team_address")
if err != nil {
return err
}
_, err = mailer.Send(ctx, mailer.Message{
IdempotencyKey: "weekly-report-2026-40",
To: []mailer.Address{{Address: team}},
Subject: "Weekly report",
Text: "The weekly report is ready in the app.",
})
return err
}
_ = process
}
Output:
Types ¶
This section is empty.