Compare commits
3 Commits
e93e3f4d9c
...
a128e4a597
| Author | SHA1 | Date | |
|---|---|---|---|
| a128e4a597 | |||
| 96f3773375 | |||
| 5db16c2355 |
49
.drone.yml
49
.drone.yml
@@ -4,10 +4,57 @@ type: docker
|
|||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: cargo_check
|
# Code quality
|
||||||
|
- name: code_quality
|
||||||
image: rust
|
image: rust
|
||||||
|
volumes:
|
||||||
|
- name: rust_registry
|
||||||
|
path: /usr/local/cargo/registry
|
||||||
commands:
|
commands:
|
||||||
- rustup component add clippy
|
- rustup component add clippy
|
||||||
- cargo clippy -- -D warnings
|
- cargo clippy -- -D warnings
|
||||||
- cargo test
|
- cargo test
|
||||||
|
|
||||||
|
# Build source code
|
||||||
|
- name: compile
|
||||||
|
image: rust
|
||||||
|
depends_on:
|
||||||
|
- code_quality
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
volumes:
|
||||||
|
- name: rust_registry
|
||||||
|
path: /usr/local/cargo/registry
|
||||||
|
- name: releases
|
||||||
|
path: /tmp/releases
|
||||||
|
commands:
|
||||||
|
- cargo build --release
|
||||||
|
- ls -lah target/release/basic-oidc
|
||||||
|
- cp target/release/basic-oidc /tmp/releases
|
||||||
|
|
||||||
|
# Auto-release to Gitea
|
||||||
|
- name: gitea_release
|
||||||
|
image: plugins/gitea-release
|
||||||
|
depends_on:
|
||||||
|
- compile
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- tag
|
||||||
|
volumes:
|
||||||
|
- name: releases
|
||||||
|
path: /tmp/releases
|
||||||
|
environment:
|
||||||
|
PLUGIN_API_KEY:
|
||||||
|
from_secret: GITEA_API_KEY # needs permission write:repository
|
||||||
|
settings:
|
||||||
|
base_url: https://gitea.communiquons.org
|
||||||
|
files:
|
||||||
|
- /tmp/releases/basic-oidc
|
||||||
|
checksum: sha512
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: rust_registry
|
||||||
|
temp: { }
|
||||||
|
- name: releases
|
||||||
|
temp: {}
|
||||||
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -595,7 +595,6 @@ dependencies = [
|
|||||||
"clap",
|
"clap",
|
||||||
"digest",
|
"digest",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
"futures-util",
|
|
||||||
"include_dir",
|
"include_dir",
|
||||||
"jwt-simple",
|
"jwt-simple",
|
||||||
"lazy-regex",
|
"lazy-regex",
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ bcrypt = "0.17.1"
|
|||||||
uuid = { version = "1.18.1", features = ["v4"] }
|
uuid = { version = "1.18.1", features = ["v4"] }
|
||||||
mime_guess = "2.0.5"
|
mime_guess = "2.0.5"
|
||||||
askama = "0.14.0"
|
askama = "0.14.0"
|
||||||
futures-util = "0.3.31"
|
|
||||||
urlencoding = "2.1.3"
|
urlencoding = "2.1.3"
|
||||||
rand = "0.9.2"
|
rand = "0.9.2"
|
||||||
base64 = "0.22.1"
|
base64 = "0.22.1"
|
||||||
|
|||||||
@@ -18,6 +18,14 @@ pub struct AppConfig {
|
|||||||
#[clap(short, long, env)]
|
#[clap(short, long, env)]
|
||||||
pub storage_path: String,
|
pub storage_path: String,
|
||||||
|
|
||||||
|
/// Overwrite clients list file path, if the file is not to be found in storage path
|
||||||
|
#[clap(long, env)]
|
||||||
|
pub clients_list_file_path: Option<String>,
|
||||||
|
|
||||||
|
/// Overwrite providers list file path, if the file is not to be found in storage path
|
||||||
|
#[clap(long, env)]
|
||||||
|
pub providers_list_file_path: Option<String>,
|
||||||
|
|
||||||
/// App token token
|
/// App token token
|
||||||
#[clap(short, long, env, default_value = "")]
|
#[clap(short, long, env, default_value = "")]
|
||||||
pub token_key: String,
|
pub token_key: String,
|
||||||
@@ -32,7 +40,7 @@ pub struct AppConfig {
|
|||||||
|
|
||||||
/// IP location service API
|
/// IP location service API
|
||||||
///
|
///
|
||||||
/// Up instance of IP location service : https://gitlab.com/pierre42100/iplocationserver
|
/// Operating instance of IP location service : https://gitlab.com/pierre42100/iplocationserver
|
||||||
///
|
///
|
||||||
/// Example: "https://api.geoip.rs"
|
/// Example: "https://api.geoip.rs"
|
||||||
#[arg(long, short, env)]
|
#[arg(long, short, env)]
|
||||||
@@ -71,11 +79,17 @@ impl AppConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn clients_file(&self) -> PathBuf {
|
pub fn clients_file(&self) -> PathBuf {
|
||||||
self.storage_path().join(CLIENTS_LIST_FILE)
|
match &self.clients_list_file_path {
|
||||||
|
None => self.storage_path().join(CLIENTS_LIST_FILE),
|
||||||
|
Some(p) => Path::new(p).to_path_buf(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn providers_file(&self) -> PathBuf {
|
pub fn providers_file(&self) -> PathBuf {
|
||||||
self.storage_path().join(PROVIDERS_LIST_FILE)
|
match &self.providers_list_file_path {
|
||||||
|
None => self.storage_path().join(PROVIDERS_LIST_FILE),
|
||||||
|
Some(p) => Path::new(p).to_path_buf(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn full_url(&self, uri: &str) -> String {
|
pub fn full_url(&self, uri: &str) -> String {
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ impl Client {
|
|||||||
|
|
||||||
pub type ClientManager = EntityManager<Client>;
|
pub type ClientManager = EntityManager<Client>;
|
||||||
|
|
||||||
impl EntityManager<Client> {
|
impl ClientManager {
|
||||||
pub fn find_by_id(&self, u: &ClientID) -> Option<Client> {
|
pub fn find_by_id(&self, u: &ClientID) -> Option<Client> {
|
||||||
for entry in self.iter() {
|
for entry in self.iter() {
|
||||||
if entry.id.eq(u) {
|
if entry.id.eq(u) {
|
||||||
|
|||||||
Reference in New Issue
Block a user