Page MenuHomeDevCentral

D1867.diff
No OneTemporary

D1867.diff

diff --git a/.arcconfig b/.arcconfig
new file mode 100644
--- /dev/null
+++ b/.arcconfig
@@ -0,0 +1,4 @@
+{
+ "phabricator.uri": "https://devcentral.nasqueron.org",
+ "repository.callsign": "APIREG"
+}
diff --git a/.arclint b/.arclint
new file mode 100644
--- /dev/null
+++ b/.arclint
@@ -0,0 +1,24 @@
+{
+ "linters": {
+ "chmod": {
+ "type": "chmod"
+ },
+ "filename": {
+ "type": "filename"
+ },
+ "json": {
+ "type": "json",
+ "include": [
+ "(^\\.arcconfig$)",
+ "(^\\.arclint$)",
+ "(\\.json$)"
+ ]
+ },
+ "merge-conflict": {
+ "type": "merge-conflict"
+ },
+ "spelling": {
+ "type": "spelling"
+ }
+ }
+}
diff --git a/.gitignore b/.gitignore
new file mode 100644
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/target
+**/*.rs.bk
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "docker-registry-api"
+version = "0.1.0"
+authors = ["Sébastien Santoro <dereckson@espace-win.org>"]
+edition = "2018"
+
+[dependencies]
+env_logger = "^0.5.13"
+limiting-factor = { path = "../limiting-factor", features = ["minimal"] }
+rocket = "^0.3.16"
+rocket_codegen = "^0.3.16"
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,25 @@
+Copyright 2018 Sébastien Santoro aka Dereckson
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
new file mode 100644
diff --git a/Rocket.toml b/Rocket.toml
new file mode 100644
--- /dev/null
+++ b/Rocket.toml
@@ -0,0 +1,3 @@
+[global]
+address = "0.0.0.0"
+port = 8000
diff --git a/assets/favicon.ico b/assets/favicon.ico
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
diff --git a/src/app.rs b/src/app.rs
new file mode 100644
--- /dev/null
+++ b/src/app.rs
@@ -0,0 +1,14 @@
+//! Docker Registry API application entry point
+
+use crate::requests::*;
+use limiting_factor::kernel::MinimalApplication;
+
+pub fn run () {
+
+ let routes = routes![
+ status,
+ favicon,
+ ];
+
+ MinimalApplication::start_application(routes);
+}
diff --git a/src/lib.rs b/src/lib.rs
new file mode 100644
--- /dev/null
+++ b/src/lib.rs
@@ -0,0 +1,5 @@
+#![feature(plugin)]
+#![plugin(rocket_codegen)]
+
+pub mod app;
+pub mod requests;
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,7 @@
+use docker_registry_api::app::run;
+
+fn main() {
+ env_logger::init();
+
+ run();
+}
diff --git a/src/requests.rs b/src/requests.rs
new file mode 100644
--- /dev/null
+++ b/src/requests.rs
@@ -0,0 +1,15 @@
+//!
+//! Requests handled by the microservice.
+//!
+
+use rocket::response::NamedFile;
+
+#[get("/status")]
+pub fn status() -> &'static str {
+ "ALIVE"
+}
+
+#[get("/favicon.ico")]
+pub fn favicon() -> Option<NamedFile> {
+ NamedFile::open("assets/favicon.ico").ok()
+}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 16:20 (18 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258403
Default Alt Text
D1867.diff (4 KB)

Event Timeline