-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
187 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ members = [ | |
"goldboot", | ||
"goldboot-image", | ||
"goldboot-macros", | ||
"goldboot-registry", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
name = "goldboot-registry" | ||
description = "A web service for hosting goldboot images" | ||
version = "0.0.1" | ||
edition = "2021" | ||
license = "AGPL-3.0-only" | ||
authors = ["Tyler Cook"] | ||
readme = "README.md" | ||
homepage = "https://goldboot.org" | ||
repository = "https://github.com/fossable/goldboot/" | ||
rust-version = "1.74" | ||
|
||
[dependencies] | ||
anyhow = "1.0.76" | ||
axum = "0.7.4" | ||
clap = { version = "4.4.7", features = ["derive", "string"] } | ||
goldboot = { path="../goldboot", version = "0.0.2" } | ||
goldboot-image = { path="../goldboot-image", version = "0.0.1" } | ||
reqwest = { version = "0.11.22", features = ["stream"] } | ||
tokio = { version = "1.34.0", features = ["full"] } | ||
tracing = "0.1.40" | ||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM alpine:latest | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG TARGETVARIANT | ||
|
||
RUN apk add --no-cache qemu-system-aarch64 qemu-system-arm qemu-system-x86_64 | ||
|
||
COPY ${TARGETOS}-${TARGETARCH}${TARGETVARIANT}/goldboot-registry /usr/bin/goldboot-registry | ||
RUN chmod +x /usr/bin/goldboot-registry | ||
|
||
WORKDIR /root | ||
ENTRYPOINT ["/usr/bin/goldboot-registry"] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use crate::extract::ImageHandle; | ||
use axum::{ | ||
extract::{Path, State}, | ||
http::StatusCode, | ||
Json, | ||
}; | ||
use goldboot::registry::api::image::ImageInfoResponse; | ||
|
||
/// Get image info | ||
pub async fn info(image: ImageHandle) -> Json<ImageInfoResponse> { | ||
Json(image.0.into()) | ||
} | ||
|
||
/// Get image list | ||
pub async fn list() {} | ||
|
||
// Push an image | ||
/* | ||
pub async fn push(id: web::Path<String>, rq: actix_web::HttpRequest) -> Result<HttpResponse> { | ||
let path = match ImageLibrary::find_by_id(&id) { | ||
Ok(image) => { | ||
// Delete if the image already exists | ||
if Path::new(&image.path).exists() { | ||
std::fs::remove_file(&image.path)?; | ||
} | ||
image.path | ||
}, | ||
_ => format!("{}.gb", id), | ||
}; | ||
let mut file = File::create(&path)?; | ||
std::io::copy(&mut rq, &mut file)?; | ||
"" | ||
}*/ | ||
|
||
/// Get cluster data | ||
pub async fn clusters(Path(_id): Path<String>, Path(_range): Path<String>) {} | ||
|
||
/// Get cluster hashes | ||
pub async fn hashes(Path(_id): Path<String>, Path(_range): Path<String>) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod build; | ||
pub mod image; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#[derive(clap::Subcommand, Debug)] | ||
pub enum Commands { | ||
/// Run the registry server | ||
Start {}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use crate::cmd::Commands; | ||
use axum::{routing::get, Router}; | ||
use clap::Parser; | ||
use std::{env, process::ExitCode}; | ||
|
||
pub mod api; | ||
pub mod cmd; | ||
pub mod extract; | ||
|
||
#[derive(Parser, Debug)] | ||
#[clap(author, version, about, long_about = None)] | ||
struct CommandLine { | ||
#[clap(subcommand)] | ||
command: Option<Commands>, | ||
} | ||
|
||
#[derive(Clone)] | ||
pub struct RegistryState {} | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let command_line = CommandLine::parse(); | ||
tracing_subscriber::fmt() | ||
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) | ||
.init(); | ||
|
||
let state = RegistryState {}; | ||
|
||
let app = Router::new() | ||
.route("/image/list", get(api::image::list)) | ||
.route("/image/info/:image_id", get(api::image::info)) | ||
.with_state(state); | ||
|
||
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap(); | ||
axum::serve(listener, app).await.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
pub mod image; | ||
|
||
pub struct RegistryTokenPermissions { | ||
// TODO | ||
} | ||
|
||
pub struct RegistryToken { | ||
/// The token value | ||
pub token: String, | ||
|
||
/// Whether the token value has been hashed with PBKDF2 | ||
pub hashed: bool, | ||
|
||
/// Whether the token value has been encrypted with AES256 | ||
pub encrypted: bool, | ||
|
||
/// A time-based second factor secret URL associated with the token | ||
pub totp_secret_url: Option<String>, | ||
|
||
/// The expiration timestamp | ||
pub expiration: Option<u64>, | ||
|
||
/// The token's associated permissions | ||
pub permissions: RegistryTokenPermissions, | ||
} |
Empty file.
Oops, something went wrong.