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 SERVICES_CACHE: &str = cloud_container::SERVICES_CACHE;
22 pub const STORAGE: &str = cloud_container::STORAGE;
23 pub const WEB: &str = cloud_container::WEB;
24 pub const WEB_DIST: &str = cloud_container::WEB_DIST;
25 pub const WEB_CONFIG: &str = cloud_container::WEB_CONFIG;
26 pub const PROFILES: &str = cloud_container::PROFILES;
27 pub const TEMPLATES: &str = cloud_container::TEMPLATES;
28 pub const ASSETS: &str = cloud_container::ASSETS;
29}
30
31pub const CALLBACK_TIMEOUT_SECS: u64 = 300;
32
33pub mod oauth {
34 pub const CALLBACK_PORT: u16 = 8765;
35 pub const CALLBACK_TIMEOUT_SECS: u64 = super::CALLBACK_TIMEOUT_SECS;
36}
37
38pub mod credentials {
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::CREDENTIALS;
43
44 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}
74
75pub mod paths {
76 use super::{dir_names, file_names};
77
78 pub const ROOT_DIR: &str = dir_names::SYSTEMPROMPT;
79 pub const PROFILES_DIR: &str = dir_names::PROFILES;
80 pub const DOCKER_DIR: &str = dir_names::DOCKER;
81 pub const STORAGE_DIR: &str = dir_names::STORAGE;
82 pub const DOCKERFILE: &str = file_names::DOCKERFILE;
83 pub const PROFILE_CONFIG: &str = file_names::PROFILE_CONFIG;
84 pub const PROFILE_SECRETS: &str = file_names::PROFILE_SECRETS;
85 pub const CREDENTIALS_FILE: &str = file_names::CREDENTIALS;
86 pub const TENANTS_FILE: &str = file_names::TENANTS;
87 pub const SESSION_FILE: &str = file_names::SESSION;
88 pub const PROFILE_DOCKER_DIR: &str = dir_names::DOCKER;
89 pub const ENTRYPOINT: &str = file_names::ENTRYPOINT;
90 pub const DOCKERIGNORE: &str = file_names::DOCKERIGNORE;
91 pub const COMPOSE_FILE: &str = file_names::COMPOSE;
92}
93
94pub mod profile {
95 use super::container;
96
97 pub const DEFAULT_DB_TYPE: &str = "postgres";
98 pub const DEFAULT_PORT: u16 = 8080;
99 pub const LOCAL_HOST: &str = "127.0.0.1";
100 pub const CLOUD_HOST: &str = "0.0.0.0";
101 pub const DEFAULT_CLOUD_URL: &str = "https://cloud.systemprompt.io";
102 pub const LOCAL_ISSUER: &str = "systemprompt-local";
103 pub const CLOUD_ISSUER: &str = "systemprompt";
104 pub const ACCESS_TOKEN_EXPIRATION: i64 = 2_592_000;
105 pub const REFRESH_TOKEN_EXPIRATION: i64 = 15_552_000;
106 pub const CLOUD_APP_PATH: &str = container::APP_ROOT;
107 pub const CREDENTIALS_PATH: &str = "../../credentials.json";
108 pub const TENANTS_PATH: &str = "../../tenants.json";
109}
110
111pub mod proxies {
112 pub const PRIVATE_RANGES: &[&str] = &[
113 "127.0.0.0/8",
114 "::1/128",
115 "10.0.0.0/8",
116 "172.16.0.0/12",
117 "192.168.0.0/16",
118 ];
119
120 pub const FLY_PRIVATE_RANGES: &[&str] = &["fc00::/7"];
121
122 pub const FLY_PUBLIC_RANGES: &[&str] = &["66.241.64.0/18"];
123
124 pub const CLOUDFLARE_RANGES: &[&str] = &[
125 "173.245.48.0/20",
126 "103.21.244.0/22",
127 "103.22.200.0/22",
128 "103.31.4.0/22",
129 "141.101.64.0/18",
130 "108.162.192.0/18",
131 "190.93.240.0/20",
132 "188.114.96.0/20",
133 "197.234.240.0/22",
134 "198.41.128.0/17",
135 "162.158.0.0/15",
136 "104.16.0.0/13",
137 "104.24.0.0/14",
138 "172.64.0.0/13",
139 "131.0.72.0/22",
140 "2400:cb00::/32",
141 "2606:4700::/32",
142 "2803:f800::/32",
143 "2405:b500::/32",
144 "2405:8100::/32",
145 "2a06:98c0::/29",
146 "2c0f:f248::/32",
147 ];
148}
149
150pub mod env_vars {
151 pub use systemprompt_models::paths::constants::env_vars::CUSTOM_SECRETS;
152
153 pub const SYSTEM_MANAGED: &[&str] = &[
154 systemprompt_models::subprocess::DEPLOYMENT_HOST_ENV,
155 "FLY_APP_NAME",
156 "FLY_MACHINE_ID",
157 ];
158
159 pub const CLI_SYNCED: &[&str] = &[
160 "SYSTEMPROMPT_API_TOKEN",
161 "SYSTEMPROMPT_USER_EMAIL",
162 "SYSTEMPROMPT_CLI_REMOTE",
163 "SYSTEMPROMPT_PROFILE",
164 ];
165
166 pub fn is_system_managed(key: &str) -> bool {
167 SYSTEM_MANAGED.iter().any(|&k| k.eq_ignore_ascii_case(key))
168 }
169}