Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created issues for TODOs. Added links here. #59

Merged
merged 1 commit into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion api/api.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ PARAMETER_TABLE_CLOSE = "</table>\n\n"
PARAMETER_ROW = "<tr><td class='parameter'>{{NAME}}</td><td class='type'>{{TYPE}}</td></tr>\n"
PARAMETER_NONE = "<div class='meta'>None</div>"

# TODO Maybe refactor to eliminate redundancy with HTML_TOP and HTML_BOTTOM
# TODO https://github.com/EspressoSystems/tide-disco/issues/52
MINIMAL_HTML = """
<!doctype html>
<html lang='en'>
Expand Down
7 changes: 3 additions & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,25 +262,24 @@ impl<State: Send + Sync + 'static, Error: 'static + crate::Error> App<State, Err
});

// Register catch-all routes for discoverability
// TODO https://github.com/EspressoSystems/tide-disco/issues/54
{
server
.at("/")
.get(move |req: tide::Request<Arc<Self>>| async move {
// TODO invoke disco_web_handler with the URL, etc.
Ok(format!("help /\n{:?}", req.url()))
});
}
{
server
.at("/*")
.get(move |req: tide::Request<Arc<Self>>| async move {
// TODO invoke disco_web_handler with the URL, etc.
Ok(format!("help /*\n{:?}", req.url()))
});
}
// TODO add a call to serve_dir
// TODO https://github.com/EspressoSystems/tide-disco/issues/55
{
// TODO This path is not found for address-book
// This path is not found for address-book
//server.at("/public").serve_dir("public/media/")?;
}

Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ impl UrlSegment {
}
}

// TODO Associate a handler with a pattern somehow.
// TODO https://github.com/EspressoSystems/tide-disco/issues/54
pub async fn disco_dispatch(
req: Request<AppServerState>,
bindings: HashMap<String, UrlSegment>,
Expand Down Expand Up @@ -789,7 +789,7 @@ pub async fn init_web_server(
.allow_credentials(true),
);

// TODO Replace these hardcoded routes with api.toml routes
// TODO https://github.com/EspressoSystems/tide-disco/issues/58
web_server.at("/help").get(compose_reference_documentation);
web_server.at("/help/").get(compose_reference_documentation);
web_server.at("/healthcheck").get(healthcheck);
Expand Down Expand Up @@ -877,7 +877,7 @@ pub fn compose_settings<Args: CommandFactory>(
// keys lower case. This is a config-rs bug. See https://github.com/mehcode/config-rs/issues/340
let mut builder = Config::builder()
.set_default(DiscoKey::base_url.as_ref(), "http://localhost:65535")?
.set_default(DiscoKey::disco_toml.as_ref(), "disco.toml")? // TODO path to share config
.set_default(DiscoKey::disco_toml.as_ref(), "disco.toml")?
.set_default(
DiscoKey::app_toml.as_ref(),
app_api_path(org_name, app_name)
Expand Down
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ mod signal;

impl Interrupt for InterruptHandle {
fn signal_action(signal: i32) {
// TOOD modify web_state based on the signal.
println!("\nReceived signal {}", signal);
process::exit(1);
}
}

// This demonstrates the older way of configuring the web server. What's valuable here is that it
// shows the bare bones of discoverability from a TOML file.
// TODO integrate discoverability into the new method of wrapping Tide.
#[async_std::main]
async fn main() -> Result<(), ConfigError> {
let api_path = current_dir().unwrap().join("api").join("api.toml");
Expand Down
2 changes: 1 addition & 1 deletion src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ impl<State, Error> Route<State, Error> {
for path in paths.iter() {
for seg in path.split('/') {
if seg.starts_with(':') {
// TODO also accept a structure with param_type and required
// TODO https://github.com/EspressoSystems/tide-disco/issues/56
let ptype = RequestParamType::from_str(
spec[seg]
.as_str()
Expand Down
4 changes: 1 addition & 3 deletions src/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ impl InterruptHandle {
// Stop waiting for an interrupt.
self.handle.close();

// TODO This is here to mimic the example in the documentation, but
// it doesn't seem to make any difference whether or not it's here. Why?
// https://docs.rs/signal-hook-async-std/latest/signal_hook_async_std/
// TODO https://github.com/EspressoSystems/tide-disco/issues/57
if let Some(task) = &mut self.task.take() {
task.await
}
Expand Down