systemprompt_cloud/
constants.rs1pub use systemprompt_models::paths::constants::{build, dir_names, file_names, storage};
12
13pub mod container {
14 use systemprompt_models::paths::constants::cloud_container;
15
16 pub const APP: &str = cloud_container::APP_ROOT;
17 pub const APP_ROOT: &str = cloud_container::APP_ROOT;
18 pub const BIN: &str = cloud_container::BIN;
19 pub const LOGS: &str = cloud_container::LOGS;
20 pub const SERVICES: &str = cloud_container::SERVICES;
21 pub const STORAGE: &str = cloud_container::STORAGE;
22 pub const WEB: &str = cloud_container::WEB;
23 pub const WEB_DIST: &str = cloud_container::WEB_DIST;
24 pub const WEB_CONFIG: &str = cloud_container::WEB_CONFIG;
25 pub const PROFILES: &str = cloud_container::PROFILES;
26 pub const TEMPLATES: &str = cloud_container::TEMPLATES;
27 pub const ASSETS: &str = cloud_container::ASSETS;
28}
29
30pub const CALLBACK_TIMEOUT_SECS: u64 = 300;
31
32pub mod oauth {
33 pub const CALLBACK_PORT: u16 = 8765;
34 pub const CALLBACK_TIMEOUT_SECS: u64 = super::CALLBACK_TIMEOUT_SECS;
35}
36
37pub mod checkout {
38 pub const CALLBACK_PORT: u16 = 8766;
39 pub const CALLBACK_TIMEOUT_SECS: u64 = super::CALLBACK_TIMEOUT_SECS;
40 pub const PROVISIONING_POLL_INTERVAL_MS: u64 = 2000;
41}
42
43pub mod credentials {
44 use super::{dir_names, file_names};
45
46 pub const DEFAULT_DIR_NAME: &str = dir_names::SYSTEMPROMPT;
47 pub const DEFAULT_FILE_NAME: &str = file_names::CREDENTIALS;
48
49 pub const VALIDATION_TTL_SECS: i64 = 900;
55}
56
57pub mod tenants {
58 use super::{dir_names, file_names};
59
60 pub const DEFAULT_DIR_NAME: &str = dir_names::SYSTEMPROMPT;
61 pub const DEFAULT_FILE_NAME: &str = file_names::TENANTS;
62}
63
64pub mod cli_session {
65 use super::{dir_names, file_names};
66
67 pub const DEFAULT_DIR_NAME: &str = dir_names::SYSTEMPROMPT;
68 pub const DEFAULT_FILE_NAME: &str = file_names::SESSION;
69}
70
71pub mod docker {
72 pub const CONTAINER_NAME_PREFIX: &str = "systemprompt-postgres";
73 pub const COMPOSE_PATH: &str = "infrastructure/docker";
74
75 pub fn container_name(env_name: &str) -> String {
76 format!("{}-{}", CONTAINER_NAME_PREFIX, env_name)
77 }
78}
79
80pub mod api {
81 pub const PRODUCTION_URL: &str = "https://api.systemprompt.io";
82 pub const SANDBOX_URL: &str = "https://api-sandbox.systemprompt.io";
83 pub const DB_PRODUCTION_HOST: &str = "db.systemprompt.io";
84 pub const DB_SANDBOX_HOST: &str = "db-sandbox.systemprompt.io";
85}
86
87pub mod regions {
88 pub const AVAILABLE: &[(&str, &str)] = &[
89 ("iad", "US East (Virginia)"),
90 ("lhr", "Europe (London)"),
91 ("fra", "Europe (Frankfurt)"),
92 ("ams", "Europe (Amsterdam)"),
93 ("sin", "Asia (Singapore)"),
94 ("nrt", "Asia (Tokyo)"),
95 ("syd", "Australia (Sydney)"),
96 ("gru", "South America (São Paulo)"),
97 ];
98}
99
100pub mod paths {
101 use super::{dir_names, file_names};
102
103 pub const ROOT_DIR: &str = dir_names::SYSTEMPROMPT;
104 pub const PROFILES_DIR: &str = dir_names::PROFILES;
105 pub const DOCKER_DIR: &str = dir_names::DOCKER;
106 pub const STORAGE_DIR: &str = dir_names::STORAGE;
107 pub const DOCKERFILE: &str = file_names::DOCKERFILE;
108 pub const PROFILE_CONFIG: &str = file_names::PROFILE_CONFIG;
109 pub const PROFILE_SECRETS: &str = file_names::PROFILE_SECRETS;
110 pub const CREDENTIALS_FILE: &str = file_names::CREDENTIALS;
111 pub const TENANTS_FILE: &str = file_names::TENANTS;
112 pub const SESSION_FILE: &str = file_names::SESSION;
113 pub const PROFILE_DOCKER_DIR: &str = dir_names::DOCKER;
114 pub const ENTRYPOINT: &str = file_names::ENTRYPOINT;
115 pub const DOCKERIGNORE: &str = file_names::DOCKERIGNORE;
116 pub const COMPOSE_FILE: &str = file_names::COMPOSE;
117}
118
119pub mod profile {
120 use super::container;
121
122 pub const DEFAULT_DB_TYPE: &str = "postgres";
123 pub const DEFAULT_PORT: u16 = 8080;
124 pub const LOCAL_HOST: &str = "127.0.0.1";
125 pub const CLOUD_HOST: &str = "0.0.0.0";
126 pub const DEFAULT_CLOUD_URL: &str = "https://cloud.systemprompt.io";
127 pub const LOCAL_ISSUER: &str = "systemprompt-local";
128 pub const CLOUD_ISSUER: &str = "systemprompt";
129 pub const ACCESS_TOKEN_EXPIRATION: i64 = 2_592_000;
130 pub const REFRESH_TOKEN_EXPIRATION: i64 = 15_552_000;
131 pub const CLOUD_APP_PATH: &str = container::APP_ROOT;
132 pub const CREDENTIALS_PATH: &str = "../../credentials.json";
133 pub const TENANTS_PATH: &str = "../../tenants.json";
134}
135
136pub mod proxies {
137 pub const PRIVATE_RANGES: &[&str] = &[
138 "127.0.0.0/8",
139 "::1/128",
140 "10.0.0.0/8",
141 "172.16.0.0/12",
142 "192.168.0.0/16",
143 ];
144
145 pub const FLY_PRIVATE_RANGES: &[&str] = &["fc00::/7"];
146
147 pub const FLY_PUBLIC_RANGES: &[&str] = &["66.241.64.0/18"];
148
149 pub const CLOUDFLARE_RANGES: &[&str] = &[
150 "173.245.48.0/20",
151 "103.21.244.0/22",
152 "103.22.200.0/22",
153 "103.31.4.0/22",
154 "141.101.64.0/18",
155 "108.162.192.0/18",
156 "190.93.240.0/20",
157 "188.114.96.0/20",
158 "197.234.240.0/22",
159 "198.41.128.0/17",
160 "162.158.0.0/15",
161 "104.16.0.0/13",
162 "104.24.0.0/14",
163 "172.64.0.0/13",
164 "131.0.72.0/22",
165 "2400:cb00::/32",
166 "2606:4700::/32",
167 "2803:f800::/32",
168 "2405:b500::/32",
169 "2405:8100::/32",
170 "2a06:98c0::/29",
171 "2c0f:f248::/32",
172 ];
173}
174
175pub mod env_vars {
176 pub use systemprompt_models::paths::constants::env_vars::CUSTOM_SECRETS;
177
178 pub const SYSTEM_MANAGED: &[&str] = &["FLY_APP_NAME", "FLY_MACHINE_ID"];
179
180 pub const CLI_SYNCED: &[&str] = &[
181 "SYSTEMPROMPT_API_TOKEN",
182 "SYSTEMPROMPT_USER_EMAIL",
183 "SYSTEMPROMPT_CLI_REMOTE",
184 "SYSTEMPROMPT_PROFILE",
185 ];
186
187 pub fn is_system_managed(key: &str) -> bool {
188 SYSTEM_MANAGED.iter().any(|&k| k.eq_ignore_ascii_case(key))
189 }
190}