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