Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
c6d17b4904 | |||
f52f9d65fd | |||
f8662b6020 | |||
e7517f94dc | |||
98e187056d | |||
2bd6fd8f85 |
@@ -8,9 +8,10 @@ build:
|
||||
image: rust:1.85
|
||||
script:
|
||||
- cargo build --release
|
||||
- ls -R target/release/
|
||||
artifacts:
|
||||
paths:
|
||||
- target/release/icarus-models
|
||||
- target/release/
|
||||
expire_in: 1 week
|
||||
cache:
|
||||
key: "cargo-cache"
|
||||
@@ -29,6 +30,16 @@ test:
|
||||
- target/
|
||||
- ~/.cargo/
|
||||
|
||||
test_variable:
|
||||
stage: test
|
||||
image: rust:1.85
|
||||
script:
|
||||
- echo "Checking CARGO_LOGIN_TOKEN..."
|
||||
- if [[ -z "$CARGO_LOGIN_TOKEN" ]]; then echo "CARGO_LOGIN_TOKEN is empty!"; exit 1; else echo "CARGO_LOGIN_TOKEN is set."; fi
|
||||
- env
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG'
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
image: rust:1.85
|
||||
@@ -36,7 +47,8 @@ deploy:
|
||||
- echo "Printing environment"
|
||||
- env
|
||||
- cargo login "$CARGO_LOGIN_TOKEN"
|
||||
- cargo publish
|
||||
- echo "Next step"
|
||||
# - cargo publish
|
||||
dependencies:
|
||||
- build
|
||||
rules:
|
||||
|
@@ -2,7 +2,7 @@
|
||||
name = "icarus-models"
|
||||
description = "models used for the icarus project"
|
||||
license = "MIT"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
@@ -1,5 +1,6 @@
|
||||
pub mod access_level;
|
||||
pub mod login_result;
|
||||
pub mod token;
|
||||
pub mod user;
|
||||
|
||||
pub fn add(left: u64, right: u64) -> u64 {
|
||||
|
40
src/token.rs
Normal file
40
src/token.rs
Normal file
@@ -0,0 +1,40 @@
|
||||
use std::default::Default;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Token {
|
||||
pub scope: String,
|
||||
pub expiration: i32,
|
||||
pub audience: String,
|
||||
pub issuer: String,
|
||||
pub issued: i32,
|
||||
}
|
||||
|
||||
impl Default for Token {
|
||||
fn default() -> Self {
|
||||
Token {
|
||||
scope: String::new(),
|
||||
expiration: -1,
|
||||
audience: String::new(),
|
||||
issuer: String::new(),
|
||||
issued: -1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Token {
|
||||
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
|
||||
return serde_json::to_string_pretty(&self);
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
pub fn token_expired(&self) -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Implement
|
||||
pub fn contains_scope(&self, des_scope: String) -> bool {
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user