Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions crates/goose-server/src/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,7 @@ derive_utoipa!(Icon as IconSchema);
super::routes::status::system_info,
super::routes::status::diagnostics,
super::routes::mcp_ui_proxy::mcp_ui_proxy,
super::routes::config_management::backup_config,
super::routes::config_management::recover_config,
super::routes::config_management::validate_config,
super::routes::config_management::init_config,
super::routes::config_management::upsert_config,
super::routes::config_management::remove_config,
super::routes::config_management::read_config,
Expand Down
83 changes: 0 additions & 83 deletions crates/goose-server/src/routes/config_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,33 +496,6 @@ pub async fn get_canonical_model_info(
})
}

#[utoipa::path(
post,
path = "/config/init",
responses(
(status = 200, description = "Config initialization check completed", body = String),
(status = 500, description = "Internal server error")
)
)]
pub async fn init_config() -> Result<Json<String>, ErrorResponse> {
let config = Config::global();

if config.exists() {
return Ok(Json("Config already exists".to_string()));
}

// Use the shared function to load init-config.yaml
match goose::config::base::load_init_config_from_workspace() {
Ok(init_values) => {
config.initialize_if_empty(init_values)?;
Ok(Json("Config initialized successfully".to_string()))
}
Err(_) => Ok(Json(
"No init-config.yaml found, using default configuration".to_string(),
)),
}
}

#[utoipa::path(
post,
path = "/config/permissions",
Expand All @@ -547,59 +520,6 @@ pub async fn upsert_permissions(
Ok(Json("Permissions updated successfully".to_string()))
}

#[utoipa::path(
post,
path = "/config/backup",
responses(
(status = 200, description = "Config file backed up", body = String),
(status = 500, description = "Internal server error")
)
)]
pub async fn backup_config() -> Result<Json<String>, ErrorResponse> {
let config_path = Paths::config_dir().join("config.yaml");

if !config_path.exists() {
return Err(ErrorResponse::not_found("Config file does not exist"));
}

let file_name = config_path
.file_name()
.ok_or_else(|| ErrorResponse::internal("Invalid config file path"))?;

let mut backup_name = file_name.to_os_string();
backup_name.push(".bak");

let backup = config_path.with_file_name(backup_name);
std::fs::copy(&config_path, &backup)?;
Ok(Json(format!("Copied {:?} to {:?}", config_path, backup)))
}

#[utoipa::path(
post,
path = "/config/recover",
responses(
(status = 200, description = "Config recovery attempted", body = String),
(status = 500, description = "Internal server error")
)
)]
pub async fn recover_config() -> Result<Json<String>, ErrorResponse> {
let config = Config::global();

// Force a reload which will trigger recovery if needed
let values = config.all_values()?;
let recovered_keys: Vec<String> = values.keys().cloned().collect();

if recovered_keys.is_empty() {
Ok(Json("Config recovery completed, but no data was recoverable. Starting with empty configuration.".to_string()))
} else {
Ok(Json(format!(
"Config recovery completed. Recovered {} keys: {}",
recovered_keys.len(),
recovered_keys.join(", ")
)))
}
}

#[utoipa::path(
get,
path = "/config/validate",
Expand Down Expand Up @@ -923,9 +843,6 @@ pub fn routes(state: Arc<AppState>) -> Router {
"/config/canonical-model-info",
post(get_canonical_model_info),
)
.route("/config/init", post(init_config))
.route("/config/backup", post(backup_config))
.route("/config/recover", post(recover_config))
.route("/config/validate", get(validate_config))
.route("/config/permissions", post(upsert_permissions))
.route("/config/custom-providers", post(create_custom_provider))
Expand Down
23 changes: 0 additions & 23 deletions crates/goose-server/ui/desktop/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,6 @@
}
}
},
"/config/backup": {
"post": {
"tags": [
"super::routes::config_management"
],
"operationId": "backup_config",
"responses": {
"200": {
"description": "Config file backed up",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
},
"500": {
"description": "Internal server error"
}
}
}
},
"/config/extensions": {
"get": {
"tags": [
Expand Down
Loading
Loading