Skip to main content

lightshuttle_manifest/model/
postgres.rs

1//! PostgreSQL resource configuration.
2
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6use super::{healthcheck::Healthcheck, volume::Volume};
7
8/// Configuration of a PostgreSQL resource.
9#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, PartialEq, Eq, Default)]
10#[serde(deny_unknown_fields)]
11pub struct PostgresConfig {
12    /// Major version. Expanded into `postgres:<version>-alpine` by the
13    /// runtime when `image` is unset.
14    #[serde(default, skip_serializing_if = "Option::is_none")]
15    pub version: Option<String>,
16
17    /// Explicit image reference. Takes precedence over `version` when
18    /// both are set.
19    #[serde(default, skip_serializing_if = "Option::is_none")]
20    pub image: Option<String>,
21
22    /// Initial database name. Defaults to the resource name when unset.
23    #[serde(default, skip_serializing_if = "Option::is_none")]
24    pub database: Option<String>,
25
26    /// Superuser name. Defaults to `"postgres"` when unset.
27    #[serde(default, skip_serializing_if = "Option::is_none")]
28    pub user: Option<String>,
29
30    /// Superuser password. Generated by the runtime when unset.
31    #[serde(default, skip_serializing_if = "Option::is_none")]
32    pub password: Option<String>,
33
34    /// Container port. Defaults to `5432` when unset.
35    #[serde(default, skip_serializing_if = "Option::is_none")]
36    pub port: Option<u16>,
37
38    /// Persistent volume configuration. Defaults to an auto-named
39    /// volume when unset.
40    #[serde(default, skip_serializing_if = "Option::is_none")]
41    pub volume: Option<Volume>,
42
43    /// Override of the default `pg_isready` healthcheck.
44    #[serde(default, skip_serializing_if = "Option::is_none")]
45    pub healthcheck: Option<Healthcheck>,
46
47    /// Names of resources this PostgreSQL instance explicitly depends on.
48    #[serde(default, skip_serializing_if = "Vec::is_empty")]
49    pub depends_on: Vec<String>,
50}