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

Make Redis fully optional for ilp-node #551

Merged
merged 3 commits into from Dec 12, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions crates/ilp-node/Cargo.toml
Expand Up @@ -9,11 +9,18 @@ repository = "https://github.com/interledger-rs/interledger-rs"
default-run = "ilp-node"

[features]
default = ["balance-tracking"]
default = ["balance-tracking", "redis"]
balance-tracking = []
# This is an experimental feature that enables submitting packet
# records to Google Cloud PubSub. This may be removed in the future.
google-pubsub = ["base64", "chrono", "parking_lot", "reqwest", "serde_json", "yup-oauth2"]
redis = ["redis_crate", "interledger/redis"]

[[test]]
name = "redis_tests"
path = "tests/redis/redis_tests.rs"
required-features = ["redis"]


[dependencies]
bytes = { version = "0.4.12", default-features = false }
Expand All @@ -26,7 +33,8 @@ lazy_static = { version = "1.4.0", default-features = false }
metrics = { version = "0.12.0", default-features = false, features = ["std"] }
metrics-core = { version = "0.5.1", default-features = false }
metrics-runtime = { version = "0.12.0", default-features = false, features = ["metrics-observer-prometheus"] }
redis = { version = "0.13.0", default-features = false, features = ["executor"] }
num-bigint = { version = "0.2.3", default-features = false, features = ["std"] }
redis_crate = { package = "redis", version = "0.13.0", default-features = false, features = ["executor"], optional = true }
ring = { version = "0.16.9", default-features = false }
serde = { version = "1.0.101", default-features = false }
tokio = { version = "0.1.22", default-features = false }
Expand All @@ -52,7 +60,6 @@ approx = { version = "0.3.2", default-features = false }
base64 = { version = "0.10.1", default-features = false }
net2 = { version = "0.2.33", default-features = false }
rand = { version = "0.7.2", default-features = false }
redis = { version = "0.13.0", default-features = false, features = ["executor"] }
reqwest = { version = "0.9.22", default-features = false, features = ["default-tls"] }
serde_json = { version = "1.0.41", default-features = false }
tokio-retry = { version = "0.2.0", default-features = false }
Expand Down
13 changes: 10 additions & 3 deletions crates/ilp-node/src/lib.rs
@@ -1,8 +1,15 @@
#![type_length_limit = "1119051"]
#![type_length_limit = "1152885"]

#[cfg(feature = "google-pubsub")]
mod google_pubsub;
mod metrics;
mod node;
mod trace;

#[cfg(feature = "google-pubsub")]
mod google_pubsub;
#[cfg(feature = "redis")]
mod redis_store;

pub use node::*;
#[allow(deprecated)]
#[cfg(feature = "redis")]
pub use redis_store::insert_account_with_redis_store;
25 changes: 15 additions & 10 deletions crates/ilp-node/src/main.rs
@@ -1,9 +1,19 @@
#![type_length_limit = "1119051"]
#![type_length_limit = "1152885"]

mod metrics;
mod node;
mod trace;

#[cfg(feature = "google-pubsub")]
mod google_pubsub;
#[cfg(feature = "redis")]
mod redis_store;

use clap::{crate_version, App, Arg, ArgMatches};
use config::{Config, Source};
use config::{FileFormat, Value};
use libc::{c_int, isatty};
use node::InterledgerNode;
use std::{
ffi::{OsStr, OsString},
io::Read,
Expand All @@ -14,13 +24,6 @@ use tracing_subscriber::{
fmt::{time::ChronoUtc, Subscriber},
};

#[cfg(feature = "google-pubsub")]
mod google_pubsub;
mod metrics;
mod node;
mod trace;
use node::InterledgerNode;

pub fn main() {
Subscriber::builder()
.with_timer(ChronoUtc::rfc3339())
Expand Down Expand Up @@ -69,8 +72,10 @@ pub fn main() {
.takes_value(true)
.required(true)
.help("HTTP Authorization token for the node admin (sent as a Bearer token)"),
Arg::with_name("redis_url")
.long("redis_url")
Arg::with_name("database_url")
.long("database_url")
// temporary alias for backwards compatibility
.alias("redis_url")
.takes_value(true)
.default_value("redis://127.0.0.1:6379")
.help("Redis URI (for example, \"redis://127.0.0.1:6379\" or \"unix:/tmp/redis.sock\")"),
Expand Down