systemprompt_cloud/
constants.rs1pub 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 pub const VALIDATION_TTL_SECS: i64 = 900;
45}
46
47pub mod tenants {
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::TENANTS;
52}
53
54pub mod cli_session {
55 use super::{dir_names, file_names};
56
57 pub const DEFAULT_DIR_NAME: &str = dir_names::SYSTEMPROMPT;
58 pub const DEFAULT_FILE_NAME: &str = file_names::SESSION;
59}
60
61pub mod docker {
62 pub const CONTAINER_NAME_PREFIX: &str = "systemprompt-postgres";
63 pub const COMPOSE_PATH: &str = "infrastructure/docker";
64
65 pub fn container_name(env_name: &str) -> String {
66 format!("{}-{}", CONTAINER_NAME_PREFIX, env_name)
67 }
68}
69
70pub mod api {
71 pub const PRODUCTION_URL: &str = "https://api.systemprompt.io";
72 pub const SANDBOX_URL: &str = "https://api-sandbox.systemprompt.io";
73 pub const DB_PRODUCTION_HOST: &str = "db.systemprompt.io";
74 pub const DB_SANDBOX_HOST: &str = "db-sandbox.systemprompt.io";
75}
76
77pub mod regions {
78 pub const AVAILABLE: &[(&str, &str)] = &[
79 ("iad", "US East (Virginia)"),
80 ("lhr", "Europe (London)"),
81 ("fra", "Europe (Frankfurt)"),
82 ("ams", "Europe (Amsterdam)"),
83 ("sin", "Asia (Singapore)"),
84 ("nrt", "Asia (Tokyo)"),
85 ("syd", "Australia (Sydney)"),
86 ("gru", "South America (São Paulo)"),
87 ];
88}
89
90pub mod paths {
91 use super::{dir_names, file_names};
92
93 pub const ROOT_DIR: &str = dir_names::SYSTEMPROMPT;
94 pub const PROFILES_DIR: &str = dir_names::PROFILES;
95 pub const DOCKER_DIR: &str = dir_names::DOCKER;
96 pub const STORAGE_DIR: &str = dir_names::STORAGE;
97 pub const DOCKERFILE: &str = file_names::DOCKERFILE;
98 pub const PROFILE_CONFIG: &str = file_names::PROFILE_CONFIG;
99 pub const PROFILE_SECRETS: &str = file_names::PROFILE_SECRETS;
100 pub const CREDENTIALS_FILE: &str = file_names::CREDENTIALS;
101 pub const TENANTS_FILE: &str = file_names::TENANTS;
102 pub const SESSION_FILE: &str = file_names::SESSION;
103 pub const PROFILE_DOCKER_DIR: &str = dir_names::DOCKER;
104 pub const ENTRYPOINT: &str = file_names::ENTRYPOINT;
105 pub const DOCKERIGNORE: &str = file_names::DOCKERIGNORE;
106 pub const COMPOSE_FILE: &str = file_names::COMPOSE;
107}
108
109pub mod profile {
110 use super::container;
111
112 pub const DEFAULT_DB_TYPE: &str = "postgres";
113 pub const DEFAULT_PORT: u16 = 8080;
114 pub const LOCAL_HOST: &str = "127.0.0.1";
115 pub const CLOUD_HOST: &str = "0.0.0.0";
116 pub const DEFAULT_CLOUD_URL: &str = "https://cloud.systemprompt.io";
117 pub const LOCAL_ISSUER: &str = "systemprompt-local";
118 pub const CLOUD_ISSUER: &str = "systemprompt";
119 pub const ACCESS_TOKEN_EXPIRATION: i64 = 2_592_000;
120 pub const REFRESH_TOKEN_EXPIRATION: i64 = 15_552_000;
121 pub const CLOUD_APP_PATH: &str = container::APP_ROOT;
122 pub const CREDENTIALS_PATH: &str = "../../credentials.json";
123 pub const TENANTS_PATH: &str = "../../tenants.json";
124}
125
126pub mod env_vars {
127 pub use systemprompt_models::paths::constants::env_vars::CUSTOM_SECRETS;
128
129 pub const SYSTEM_MANAGED: &[&str] = &["FLY_APP_NAME", "FLY_MACHINE_ID"];
130
131 pub const CLI_SYNCED: &[&str] = &[
132 "SYSTEMPROMPT_API_TOKEN",
133 "SYSTEMPROMPT_USER_EMAIL",
134 "SYSTEMPROMPT_CLI_REMOTE",
135 "SYSTEMPROMPT_PROFILE",
136 ];
137
138 pub fn is_system_managed(key: &str) -> bool {
139 SYSTEM_MANAGED.iter().any(|&k| k.eq_ignore_ascii_case(key))
140 }
141}