Skip to main content

systemprompt_cloud/
constants.rs

1pub use systemprompt_models::paths::constants::{build, dir_names, file_names, storage};
2
3pub mod container {
4    use systemprompt_models::paths::constants::cloud_container;
5
6    pub const APP: &str = cloud_container::APP_ROOT;
7    pub const APP_ROOT: &str = cloud_container::APP_ROOT;
8    pub const BIN: &str = cloud_container::BIN;
9    pub const LOGS: &str = cloud_container::LOGS;
10    pub const SERVICES: &str = cloud_container::SERVICES;
11    pub const STORAGE: &str = cloud_container::STORAGE;
12    pub const WEB: &str = cloud_container::WEB;
13    pub const WEB_DIST: &str = cloud_container::WEB_DIST;
14    pub const WEB_CONFIG: &str = cloud_container::WEB_CONFIG;
15    pub const PROFILES: &str = cloud_container::PROFILES;
16    pub const TEMPLATES: &str = cloud_container::TEMPLATES;
17    pub const ASSETS: &str = cloud_container::ASSETS;
18}
19
20pub const CALLBACK_TIMEOUT_SECS: u64 = 300;
21
22pub mod oauth {
23    pub const CALLBACK_PORT: u16 = 8765;
24    pub const CALLBACK_TIMEOUT_SECS: u64 = super::CALLBACK_TIMEOUT_SECS;
25}
26
27pub mod checkout {
28    pub const CALLBACK_PORT: u16 = 8766;
29    pub const CALLBACK_TIMEOUT_SECS: u64 = super::CALLBACK_TIMEOUT_SECS;
30    pub const PROVISIONING_POLL_INTERVAL_MS: u64 = 2000;
31}
32
33pub mod credentials {
34    use super::{dir_names, file_names};
35
36    pub const DEFAULT_DIR_NAME: &str = dir_names::SYSTEMPROMPT;
37    pub const DEFAULT_FILE_NAME: &str = file_names::CREDENTIALS;
38}
39
40pub mod tenants {
41    use super::{dir_names, file_names};
42
43    pub const DEFAULT_DIR_NAME: &str = dir_names::SYSTEMPROMPT;
44    pub const DEFAULT_FILE_NAME: &str = file_names::TENANTS;
45}
46
47pub mod cli_session {
48    use super::{dir_names, file_names};
49
50    pub const DEFAULT_DIR_NAME: &str = dir_names::SYSTEMPROMPT;
51    pub const DEFAULT_FILE_NAME: &str = file_names::SESSION;
52}
53
54pub mod docker {
55    pub const CONTAINER_NAME_PREFIX: &str = "systemprompt-postgres";
56    pub const COMPOSE_PATH: &str = "infrastructure/docker";
57
58    pub fn container_name(env_name: &str) -> String {
59        format!("{}-{}", CONTAINER_NAME_PREFIX, env_name)
60    }
61}
62
63pub mod api {
64    pub const PRODUCTION_URL: &str = "https://api.systemprompt.io";
65    pub const SANDBOX_URL: &str = "https://api-sandbox.systemprompt.io";
66    pub const DB_PRODUCTION_HOST: &str = "db.systemprompt.io";
67    pub const DB_SANDBOX_HOST: &str = "db-sandbox.systemprompt.io";
68}
69
70pub mod regions {
71    pub const AVAILABLE: &[(&str, &str)] = &[
72        ("iad", "US East (Virginia)"),
73        ("lhr", "Europe (London)"),
74        ("fra", "Europe (Frankfurt)"),
75        ("ams", "Europe (Amsterdam)"),
76        ("sin", "Asia (Singapore)"),
77        ("nrt", "Asia (Tokyo)"),
78        ("syd", "Australia (Sydney)"),
79        ("gru", "South America (São Paulo)"),
80    ];
81}
82
83pub mod paths {
84    use super::{dir_names, file_names};
85
86    pub const ROOT_DIR: &str = dir_names::SYSTEMPROMPT;
87    pub const PROFILES_DIR: &str = dir_names::PROFILES;
88    pub const DOCKER_DIR: &str = dir_names::DOCKER;
89    pub const STORAGE_DIR: &str = dir_names::STORAGE;
90    pub const DOCKERFILE: &str = file_names::DOCKERFILE;
91    pub const PROFILE_CONFIG: &str = file_names::PROFILE_CONFIG;
92    pub const PROFILE_SECRETS: &str = file_names::PROFILE_SECRETS;
93    pub const CREDENTIALS_FILE: &str = file_names::CREDENTIALS;
94    pub const TENANTS_FILE: &str = file_names::TENANTS;
95    pub const SESSION_FILE: &str = file_names::SESSION;
96    pub const PROFILE_DOCKER_DIR: &str = dir_names::DOCKER;
97    pub const ENTRYPOINT: &str = file_names::ENTRYPOINT;
98    pub const DOCKERIGNORE: &str = file_names::DOCKERIGNORE;
99    pub const COMPOSE_FILE: &str = file_names::COMPOSE;
100}
101
102pub mod profile {
103    use super::container;
104
105    pub const DEFAULT_DB_TYPE: &str = "postgres";
106    pub const DEFAULT_PORT: u16 = 8080;
107    pub const LOCAL_HOST: &str = "127.0.0.1";
108    pub const CLOUD_HOST: &str = "0.0.0.0";
109    pub const DEFAULT_CLOUD_URL: &str = "https://cloud.systemprompt.io";
110    pub const LOCAL_ISSUER: &str = "systemprompt-local";
111    pub const CLOUD_ISSUER: &str = "systemprompt";
112    pub const ACCESS_TOKEN_EXPIRATION: i64 = 2_592_000;
113    pub const REFRESH_TOKEN_EXPIRATION: i64 = 15_552_000;
114    pub const CLOUD_APP_PATH: &str = container::APP_ROOT;
115    pub const CREDENTIALS_PATH: &str = "../../credentials.json";
116    pub const TENANTS_PATH: &str = "../../tenants.json";
117}
118
119pub mod env_vars {
120    pub use systemprompt_models::paths::constants::env_vars::CUSTOM_SECRETS;
121
122    pub const SYSTEM_MANAGED: &[&str] = &["FLY_APP_NAME", "FLY_MACHINE_ID"];
123
124    pub const CLI_SYNCED: &[&str] = &[
125        "SYSTEMPROMPT_API_TOKEN",
126        "SYSTEMPROMPT_USER_EMAIL",
127        "SYSTEMPROMPT_CLI_REMOTE",
128        "SYSTEMPROMPT_PROFILE",
129    ];
130
131    pub fn is_system_managed(key: &str) -> bool {
132        SYSTEM_MANAGED.iter().any(|&k| k.eq_ignore_ascii_case(key))
133    }
134}