pub struct Config {Show 17 fields
pub root: PathBuf,
pub source: Option<PathBuf>,
pub app: AppConfig,
pub api: ApiConfig,
pub server: ServerConfig,
pub build: BuildConfig,
pub assets: AssetsConfig,
pub rendering: RenderingConfig,
pub images: ImagesConfig,
pub security: SecurityConfig,
pub env: EnvConfig,
pub dev: DevConfig,
pub logging: LoggingConfig,
pub redirects: Vec<RedirectRule>,
pub headers: Vec<HeaderRule>,
pub plugins: BTreeMap<String, Value>,
pub tailwind: TailwindConfig,
}Fields§
§root: PathBufProject root (directory containing the config file). Not read from the file.
source: Option<PathBuf>The config file that was loaded, if any.
app: AppConfig§api: ApiConfig§server: ServerConfig§build: BuildConfig§assets: AssetsConfig§rendering: RenderingConfig§images: ImagesConfig§security: SecurityConfig§env: EnvConfig§dev: DevConfig§logging: LoggingConfig§redirects: Vec<RedirectRule>§headers: Vec<HeaderRule>§plugins: BTreeMap<String, Value>Free-form plugin configuration: [plugins.my-plugin].
tailwind: TailwindConfigTailwind CSS: [tailwind].
Implementations§
Source§impl Config
impl Config
Sourcepub fn discover(start: impl AsRef<Path>) -> Result<Config, ConfigError>
pub fn discover(start: impl AsRef<Path>) -> Result<Config, ConfigError>
Discover and load the configuration starting at start.
Sourcepub fn discover_with(
start: impl AsRef<Path>,
toml: Option<fn(&str) -> Result<Config, String>>,
) -> Result<Config, ConfigError>
pub fn discover_with( start: impl AsRef<Path>, toml: Option<fn(&str) -> Result<Config, String>>, ) -> Result<Config, ConfigError>
Config::discover with an optional TOML parser. Without one,
next-rust.toml files are reported as an error and only JSON
configuration can be read.
Sourcepub fn load(path: impl AsRef<Path>) -> Result<Config, ConfigError>
pub fn load(path: impl AsRef<Path>) -> Result<Config, ConfigError>
Load a specific file (.toml or .json).
Sourcepub fn load_with(
path: impl AsRef<Path>,
toml: Option<fn(&str) -> Result<Config, String>>,
) -> Result<Config, ConfigError>
pub fn load_with( path: impl AsRef<Path>, toml: Option<fn(&str) -> Result<Config, String>>, ) -> Result<Config, ConfigError>
Config::load with an optional TOML parser (see TomlParser).
pub fn from_toml_str(text: &str) -> Result<Config, String>
pub fn from_json_str(text: &str) -> Result<Config, String>
Sourcepub fn apply_env_overrides(&mut self)
pub fn apply_env_overrides(&mut self)
PORT and HOST (conventional on container platforms) override the file.
Sourcepub fn resolve(&self, path: impl AsRef<Path>) -> PathBuf
pub fn resolve(&self, path: impl AsRef<Path>) -> PathBuf
Resolve a path from the configuration against the project root.
pub fn app_dir(&self) -> PathBuf
pub fn public_dir(&self) -> PathBuf
pub fn api_dir(&self) -> Option<PathBuf>
pub fn output_dir(&self) -> PathBuf
Sourcepub fn validate(&self) -> Vec<Diagnostic>
pub fn validate(&self) -> Vec<Diagnostic>
Validate paths and values; returns human friendly diagnostics.
Sourcepub fn tailwind_diagnostics(&self) -> Vec<Diagnostic>
pub fn tailwind_diagnostics(&self) -> Vec<Diagnostic>
Problems with the Tailwind setup that stop the CSS from compiling
(NR0008: a listed stylesheet is not a file). Part of Config::validate;
the build also checks them, since the engine’s own error is unclear.