Compare commits
7 commits
master
...
service-pr
Author | SHA1 | Date | |
---|---|---|---|
3819c93908 | |||
f6ab9102f4 | |||
02c3264b82 | |||
69b3ef7d59 | |||
7675a2c782 | |||
38ab0c3123 | |||
28a7420180 |
9 changed files with 299 additions and 497 deletions
12
.github/workflows/linux.yml
vendored
12
.github/workflows/linux.yml
vendored
|
@ -13,7 +13,6 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
version:
|
||||
#- 1.51.0
|
||||
- stable
|
||||
# - nightly
|
||||
|
||||
|
@ -52,17 +51,22 @@ jobs:
|
|||
- name: run tests
|
||||
run: make test
|
||||
|
||||
- name: build and publish docker images
|
||||
- name: build docker images
|
||||
if: matrix.version == 'stable'
|
||||
run: make docker
|
||||
|
||||
- name: publish docker images
|
||||
if: matrix.version == 'stable' && (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'realaravinth/pages'
|
||||
run: make docker-publish
|
||||
|
||||
- name: generate documentation
|
||||
if: matrix.version == 'stable' && (github.repository == 'realaravinth/pages')
|
||||
if: matrix.version == 'stable' && (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'realaravinth/pages'
|
||||
run: make doc
|
||||
env:
|
||||
GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 # dummy value
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
if: matrix.version == 'stable' && (github.repository == 'realaravinth/pages')
|
||||
if: matrix.version == 'stable' && (github.ref == 'refs/heads/master' || github.event_name == 'push') && github.repository == 'realaravinth/pages'
|
||||
uses: JamesIves/github-pages-deploy-action@3.7.1
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
696
Cargo.lock
generated
696
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
29
Cargo.toml
29
Cargo.toml
|
@ -13,24 +13,17 @@ authors = ["realaravinth <realaravinth@batsense.net>"]
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
actix-web = "4.0.0-beta.9"
|
||||
actix-http = "3.0.0-beta.8"
|
||||
actix-rt = "2"
|
||||
my-codegen = {package = "actix-web-codegen", git ="https://github.com/realaravinth/actix-web"}
|
||||
|
||||
actix-web = "4.0.1"
|
||||
actix-http = "3.0.4"
|
||||
actix-rt = "2.6.0"
|
||||
config = "0.11"
|
||||
git2 = "0.13.23"
|
||||
|
||||
serde = "1"
|
||||
serde_json = "1"
|
||||
|
||||
pretty_env_logger = "0.4"
|
||||
log = "0.4"
|
||||
|
||||
lazy_static = "1.4"
|
||||
|
||||
url = "2.2"
|
||||
|
||||
derive_more = "0.99"
|
||||
|
||||
git2 = "0.14.2"
|
||||
lazy_static = "1.4"
|
||||
log = "0.4"
|
||||
my-codegen = {package = "actix-web-codegen", git ="https://github.com/realaravinth/actix-web"}
|
||||
num_cpus = "1.13"
|
||||
pretty_env_logger = "0.4"
|
||||
serde = { version = "1", features = ["derive"]}
|
||||
serde_json = "1"
|
||||
url = "2.2"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM rust:1.56-slim-bullseye as rust
|
||||
FROM rust:slim as rust
|
||||
WORKDIR /src
|
||||
RUN apt-get update && apt-get install -y git pkg-config libssl-dev
|
||||
RUN mkdir src && echo "fn main() {}" > src/main.rs
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
**Auto-deploy static websites from git repositories**
|
||||
|
||||
`service-provider` branch contains changes and features that are more
|
||||
suited for use by folks that host large number of websites like GitHub
|
||||
Pages, etc.
|
||||
|
||||
</p>
|
||||
|
||||
[![Build](https://github.com/realaravinth/pages/actions/workflows/linux.yml/badge.svg)](https://github.com/realaravinth/pages/actions/workflows/linux.yml)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
debug = true
|
||||
log = "info" # possible values: "info", "warn", "trace", "error", "debug"
|
||||
source_code = "https://github.com/realaravinth/pages"
|
||||
|
||||
pages = [
|
||||
{ branch = "gh-pages", repo = "https://github.com/mCaptcha/website/", path ="/tmp/pages/mcaptcha/website", secret = "faee1b650ac586068a54cb160bd6353c5e16be7c64b49113fe57726e5393" },
|
||||
]
|
||||
|
@ -13,6 +12,5 @@ port = 7000
|
|||
ip= "0.0.0.0"
|
||||
# enter your hostname, eg: example.com
|
||||
domain = "localhost"
|
||||
allow_registration = true
|
||||
proxy_has_tls = false
|
||||
#workers = 2
|
||||
|
|
|
@ -47,8 +47,7 @@ pub const PKG_HOMEPAGE: &str = env!("CARGO_PKG_HOMEPAGE");
|
|||
#[cfg(not(tarpaulin_include))]
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
env::set_var("RUST_LOG", "info");
|
||||
|
||||
lazy_static::initialize(&SETTINGS);
|
||||
pretty_env_logger::init();
|
||||
|
||||
info!(
|
||||
|
@ -65,7 +64,7 @@ async fn main() -> std::io::Result<()> {
|
|||
.app_data(get_json_err())
|
||||
.wrap(
|
||||
actix_middleware::DefaultHeaders::new()
|
||||
.header("Permissions-Policy", "interest-cohort=()"),
|
||||
.add(("Permissions-Policy", "interest-cohort=()")),
|
||||
)
|
||||
.wrap(actix_middleware::NormalizePath::new(
|
||||
actix_middleware::TrailingSlash::Trim,
|
||||
|
|
18
src/page.rs
18
src/page.rs
|
@ -28,14 +28,22 @@ pub struct Page {
|
|||
|
||||
impl Page {
|
||||
pub fn create_repo(&self) -> Repository {
|
||||
let repo = Repository::open(&self.path);
|
||||
|
||||
let repo = if repo.is_err() {
|
||||
let repo = match Repository::open(&self.path) {
|
||||
Ok(repo) => repo,
|
||||
Err(e) => {
|
||||
log::error!("Opening repo {} caused error {}", &self.path, e);
|
||||
info!("Cloning repository {} at {}", self.repo, self.path);
|
||||
Repository::clone(&self.repo, &self.path).unwrap()
|
||||
} else {
|
||||
repo.unwrap()
|
||||
}
|
||||
};
|
||||
//let repo = Repository::open(&self.path);
|
||||
|
||||
//let repo = if repo.is_err() {
|
||||
// info!("Cloning repository {} at {}", self.repo, self.path);
|
||||
// Repository::clone(&self.repo, &self.path).unwrap()
|
||||
//} else {
|
||||
// repo.unwrap()
|
||||
//};
|
||||
// let branch = repo.find_branch(&self.branch, BranchType::Local).unwrap();
|
||||
|
||||
//repo.branches(BranchType::Local).unwrap().find(|b| b.unwrap().na
|
||||
|
|
|
@ -18,6 +18,7 @@ use std::env;
|
|||
use std::path::Path;
|
||||
|
||||
use config::{Config, ConfigError, Environment, File};
|
||||
use derive_more::Display;
|
||||
use log::warn;
|
||||
use serde::Deserialize;
|
||||
use url::Url;
|
||||
|
@ -40,9 +41,24 @@ impl Server {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Display, Clone, Debug)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum LogLevel {
|
||||
#[display(fmt = "debug")]
|
||||
Debug,
|
||||
#[display(fmt = "info")]
|
||||
Info,
|
||||
#[display(fmt = "trace")]
|
||||
Trace,
|
||||
#[display(fmt = "error")]
|
||||
Error,
|
||||
#[display(fmt = "warn")]
|
||||
Warn,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct Settings {
|
||||
pub debug: bool,
|
||||
pub log: LogLevel,
|
||||
// pub database: Database,
|
||||
pub server: Server,
|
||||
pub source_code: String,
|
||||
|
@ -108,6 +124,10 @@ impl Settings {
|
|||
page.fetch_upstream(&page.branch);
|
||||
}
|
||||
|
||||
const LOG_VAR: &str = "RUST_LOG";
|
||||
if env::var(LOG_VAR).is_err() {
|
||||
env::set_var("RUST_LOG", format!("{}", settings.log));
|
||||
}
|
||||
Ok(settings)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue