HomeDevCentral

Make PostgreSQL integration optional

Description

Make PostgreSQL integration optional

Summary:
Some API microservices don't need a database, as they only compute data
or fetches it from other datasources.

As such, Cargo features are prepared to allow to create a build without
diesel/r2d2 integration.

In the same way, even if we compile againt those crates, it's valuable
to make the database an option at runtime too.

Finally, to offer minimal configuration and application is valuable too
to simplify the creation of a minimal microservice. That allows code like:

//! Docker Registry API application entry point

use crate::requests::*;
use limiting_factor::kernel::MinimalApplication;

pub fn run () {
    let routes = routes![
        status,
        favicon,
        getRegistyStats,
        getRepositoryInfo
    ];

    MinimalApplication::start_application(routes);
}

Fixes T1421.

Test Plan:
Test the code above with the following Cargo entry:
limiting-factor = { path = "../limiting-factor", features = ["minimal"] }

Compile the crate both in minimal and default features profiles.

Reviewers: dereckson

Reviewed By: dereckson

Maniphest Tasks: T1421

Differential Revision: https://devcentral.nasqueron.org/D1863

Details

Provenance
derecksonAuthored on Oct 9 2018, 12:58
derecksonPushed on Oct 9 2018, 13:46
Reviewer
dereckson
Differential Revision
D1863: Make PostgreSQL integration optional
Parents
rLF80ee76e8cdcf: Improve documentation
Branches
Unknown
Tags
Unknown
Tasks
T1421: Create a SimpleApplication to run Rocket without Diesel bindings