Skip to content
GitHubXDiscord

StaticYamlFile

The StaticYamlFile resource creates YAML files with formatted content using the YAML format.

Creates a simple YAML configuration file.

import { StaticYamlFile } from "alchemy/fs";
const config = await StaticYamlFile("config.yaml", {
server: {
host: "localhost",
port: 3000,
},
});

Creates a YAML file with nested configuration objects.

import { StaticYamlFile } from "alchemy/fs";
const config = await StaticYamlFile("config.yaml", {
server: {
host: "localhost",
port: 3000,
},
database: {
url: "postgresql://localhost:5432/db",
pool: {
min: 1,
max: 10,
},
},
});

Creates a YAML file at a specific path.

import { StaticYamlFile } from "alchemy/fs";
const config = await StaticYamlFile("config", "config/app.yaml", {
environment: "production",
features: ["auth", "api", "storage"],
});