Fix demo mode: install rustls CryptoProvider, skip TLS, add ARC_DEMO env var

- Install ring CryptoProvider at CLI startup to prevent rustls panic
- Skip TLS in demo mode so the server uses plain HTTP
- Add ARC_DEMO=1 env var to web app config to bypass GitHub OAuth

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-04 11:51:57 -05:00
parent 93afb4bf6d
commit d283ece683
5 changed files with 14 additions and 4 deletions

1
Cargo.lock generated
View file

@ -196,6 +196,7 @@ dependencies = [
"rand 0.8.5",
"regex",
"reqwest 0.12.28",
"rustls",
"rustls-pemfile",
"semver",
"serde_json",

View file

@ -68,13 +68,19 @@ function loadAppConfig(): AppConfig {
const rawApi = (raw.api ?? {}) as Partial<ApiConfig>;
const rawGit = (raw.git ?? {}) as Partial<GitConfig>;
const demo = process.env.ARC_DEMO === "1";
return {
web: {
...WEB_DEFAULTS,
url: (rawWeb.url as string) ?? WEB_DEFAULTS.url,
auth: { ...AUTH_DEFAULTS, ...rawWebAuth },
auth: demo
? { provider: "insecure_disabled", allowed_usernames: [] }
: { ...AUTH_DEFAULTS, ...rawWebAuth },
},
api: { ...API_DEFAULTS, ...rawApi },
api: demo
? { ...API_DEFAULTS, authentication_strategy: "insecure_disabled" }
: { ...API_DEFAULTS, ...rawApi },
git: { ...GIT_DEFAULTS, ...rawGit },
};
}

View file

@ -154,8 +154,8 @@ pub async fn serve_command(args: ServeArgs, styles: &'static Styles) -> anyhow::
eprintln!("{}", styles.dim.apply_to("(dry-run mode)"));
}
// Branch: TLS or plain HTTP
if let Some(ref tls_config) = server_config.api.tls {
// Branch: TLS or plain HTTP (demo mode always uses plain HTTP)
if let (false, Some(ref tls_config)) = (args.demo, &server_config.api.tls) {
let client_auth = client_auth.unwrap();
let rustls_config = crate::tls::build_rustls_config(tls_config, client_auth);

View file

@ -32,6 +32,7 @@ semver.workspace = true
reqwest.workspace = true
jsonwebtoken.workspace = true
base64.workspace = true
rustls = { version = "0.23", default-features = false, features = ["std", "ring"] }
rustls-pemfile = "2"
x509-parser = "0.16"
rand.workspace = true

View file

@ -78,6 +78,8 @@ enum LlmCommand {
#[tokio::main]
async fn main() -> Result<()> {
let _ = rustls::crypto::ring::default_provider().install_default();
let cli = Cli::parse();
if !cli.no_dotenv {
if let Some(home) = dirs::home_dir() {