REWRITE IT IN RUST #1

Merged
cadey merged 4 commits from riir into master 2020-05-28 19:42:11 +00:00
3 changed files with 57 additions and 9 deletions
Showing only changes of commit 8097cc9b75 - Show all commits

View File

@ -1,8 +1,41 @@
kind: pipeline kind: pipeline
name: nix builds name: nix build and push
steps: steps:
- name: docker image - name: docker image
image: lnl7/nix:2020-03-07 image: "monacoremo/nix:2020-04-05-05f09348-circleci"
commands: commands:
- nix-build docker.nix - nix-build docker.nix
volumes:
- name: result
path: /result
- name: push image
image: docker:dind
volumes:
- name: result
path: /result
- name: dockersock
path: /var/run
commands:
- docker load -i /result/docker.tgz
- echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
- docker push xena/quickserv
environment:
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: result
temp: {}
- name: dockersock
temp: {}

View File

@ -1,13 +1,28 @@
# quickserv # quickserv
[![built with
nix](https://builtwithnix.org/badge.svg)](https://builtwithnix.org)
A quick HTTP server for when you have given up on life. A quick HTTP server for when you have given up on life.
`quickserv` serves `.` on port `3000`. Customizable with flags: `quickserv` serves `.` on port `3000`. Customizable with flags:
``` ```
Usage of quickserv: quickserv 0.1.0
-dir string A quick HTTP fileserver
directory to serve (default ".")
-port string USAGE:
port to use (default "3000") quickserv [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-d, --dir <dir> [env: DIR=] [default: .]
-p, --port <port> [env: PORT=] [default: 3000]
``` ```
## Docker

View File

@ -1,12 +1,12 @@
use std::path::PathBuf; use std::path::PathBuf;
use structopt::StructOpt; use structopt::StructOpt;
/// A basic example /// A quick HTTP fileserver
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]
#[structopt(name = "quickserv")] #[structopt(name = "quickserv")]
struct Opt { struct Opt {
// The HTTP port to listen on // The HTTP port to listen on
#[structopt(short, long, env="PORT", default_value="9001")] #[structopt(short, long, env="PORT", default_value="3000")]
port: u16, port: u16,
// The path to serve // The path to serve