Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34c22517b6
|
||
|
|
7593633304
|
||
|
|
2662065de3
|
||
|
|
349056db6e |
@@ -9,8 +9,8 @@ POSTGRES_MAIN_PASSWORD=password
|
||||
POSTGRES_MAIN_DB=my_db
|
||||
POSTGRES_MAIN_HOST=localhost
|
||||
DATABASE_URL=postgres://${POSTGRES_MAIN_USER}:${POSTGRES_MAIN_PASSWORD}@${POSTGRES_MAIN_HOST}:5432/${POSTGRES_MAIN_DB}
|
||||
ICARUS_BASE_API_URL=https://icarus.com
|
||||
ICARUS_AUTH_BASE_API_URL=https://auth.icarus.com
|
||||
SOARICARUS_BASE_API_URL=https://soaricarus.com
|
||||
SOARICARUS_AUTH_BASE_API_URL=https://auth.soaricarus.com
|
||||
APP_ENV=development
|
||||
BACKEND_PORT=8001
|
||||
FRONTEND_URL=http://localhost:4200
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ POSTGRES_MAIN_PASSWORD=password
|
||||
POSTGRES_MAIN_DB=my_db
|
||||
POSTGRES_MAIN_HOST=localhost
|
||||
DATABASE_URL=postgres://${POSTGRES_MAIN_USER}:${POSTGRES_MAIN_PASSWORD}@${POSTGRES_MAIN_HOST}:5432/${POSTGRES_MAIN_DB}
|
||||
ICARUS_BASE_API_URL=https://icarus.com
|
||||
ICARUS_AUTH_BASE_API_URL=https://auth.icarus.com
|
||||
SOARICARUS_BASE_API_URL=https://soaricarus.com
|
||||
SOARICARUS_AUTH_BASE_API_URL=https://auth.soaricarus.com
|
||||
APP_ENV=development
|
||||
BACKEND_PORT=8001
|
||||
FRONTEND_URL=http://localhost:4200
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
components: cargo
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Rust Build
|
||||
name: sienvy Build
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo check
|
||||
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo test
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- run: rustup component add rustfmt
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo fmt --all -- --check
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- run: rustup component add clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo clippy -- -D warnings
|
||||
@@ -62,6 +62,6 @@ jobs:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
toolchain: 1.96.1
|
||||
toolchain: 1.97
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: cargo build
|
||||
|
||||
Generated
+8
-8
@@ -29,14 +29,6 @@ version = "0.15.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
|
||||
|
||||
[[package]]
|
||||
name = "icarus_envy"
|
||||
version = "0.8.0"
|
||||
dependencies = [
|
||||
"const_format",
|
||||
"dotenvy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "konst"
|
||||
version = "0.2.20"
|
||||
@@ -70,6 +62,14 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sienvy"
|
||||
version = "0.8.0"
|
||||
dependencies = [
|
||||
"const_format",
|
||||
"dotenvy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.24"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "icarus_envy"
|
||||
name = "sienvy"
|
||||
version = "0.8.0"
|
||||
edition = "2024"
|
||||
rust-version = "1.95"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# sienvy
|
||||
This is a library used to retrieve environment variables associated with various
|
||||
icarus projects. Rather than having the various icarus projects such as icarus,
|
||||
icarus_auth, songparser, and others, have environment code, it would be more
|
||||
|
||||
+4
-4
@@ -38,17 +38,17 @@ pub fn get_root_directory() -> crate::EnvVar {
|
||||
crate::init_envvar(key, &value)
|
||||
}
|
||||
|
||||
pub fn get_icarus_base_api_url() -> crate::EnvVar {
|
||||
pub fn get_soaricarus_base_api_url() -> crate::EnvVar {
|
||||
dotenvy::dotenv().ok();
|
||||
let key = crate::keys::ICARUS_BASE_API_URL;
|
||||
let key = crate::keys::SOARICARUS_BASE_API_URL;
|
||||
let value = std::env::var(key).expect(key);
|
||||
|
||||
crate::init_envvar(key, &value)
|
||||
}
|
||||
|
||||
pub fn get_icarus_auth_base_api_url() -> crate::EnvVar {
|
||||
pub fn get_soaricarus_auth_base_api_url() -> crate::EnvVar {
|
||||
dotenvy::dotenv().ok();
|
||||
let key = crate::keys::ICARUS_AUTH_BASE_API_URL;
|
||||
let key = crate::keys::SOARICARUS_AUTH_BASE_API_URL;
|
||||
let value = std::env::var(key).expect(key);
|
||||
|
||||
crate::init_envvar(key, &value)
|
||||
|
||||
+10
-9
@@ -2,7 +2,7 @@
|
||||
pub const DB_URL: &str = "DATABASE_URL";
|
||||
|
||||
/// Environment key for secret main key
|
||||
/// Used for the icarus app
|
||||
/// Used for the soaricarus app
|
||||
pub const SECRET_MAIN_KEY: &str = "SECRET_MAIN_KEY";
|
||||
|
||||
/// Environment key for service logins
|
||||
@@ -12,14 +12,14 @@ pub const SERVICE_PASSPHRASE: &str = "SERVICE_PASSPHRASE";
|
||||
/// Generic use of secret key that could be found in various apps
|
||||
pub const SECRET_KEY: &str = "SECRET_KEY";
|
||||
|
||||
/// Environment key for root directory for the icarus app
|
||||
/// Environment key for root directory for the soaricarus app
|
||||
pub const ROOT_DIRECTORY: &str = "ROOT_DIRECTORY";
|
||||
|
||||
/// Environment key for icarus api url
|
||||
pub const ICARUS_BASE_API_URL: &str = "ICARUS_BASE_API_URL";
|
||||
/// Environment key for soaricarus api url
|
||||
pub const SOARICARUS_BASE_API_URL: &str = "SOARICARUS_BASE_API_URL";
|
||||
|
||||
/// Environment key for icarus auth api url
|
||||
pub const ICARUS_AUTH_BASE_API_URL: &str = "ICARUS_AUTH_BASE_API_URL";
|
||||
/// Environment key for soaricarus auth api url
|
||||
pub const SOARICARUS_AUTH_BASE_API_URL: &str = "SOARICARUS_AUTH_BASE_API_URL";
|
||||
|
||||
/// Environment key for App status
|
||||
pub const APP_ENV: &str = "APP_ENV";
|
||||
@@ -41,9 +41,10 @@ pub mod error {
|
||||
pub const SERVICE_LOGIN: &str = concatcp!(super::SERVICE_PASSPHRASE, " ", GENERAL_ERROR);
|
||||
pub const SECRET_KEY: &str = concatcp!(super::SECRET_KEY, " ", GENERAL_ERROR);
|
||||
pub const ROOT_DIRECTORY: &str = concatcp!(super::ROOT_DIRECTORY, " ", GENERAL_ERROR);
|
||||
pub const ICARUS_BASE_API_URL: &str = concatcp!(super::ICARUS_BASE_API_URL, " ", GENERAL_ERROR);
|
||||
pub const ICARUS_AUTH_BASE_API_URL: &str =
|
||||
concatcp!(super::ICARUS_AUTH_BASE_API_URL, " ", GENERAL_ERROR);
|
||||
pub const SOARICARUS_BASE_API_URL: &str =
|
||||
concatcp!(super::SOARICARUS_BASE_API_URL, " ", GENERAL_ERROR);
|
||||
pub const SOARICARUS_AUTH_BASE_API_URL: &str =
|
||||
concatcp!(super::SOARICARUS_AUTH_BASE_API_URL, " ", GENERAL_ERROR);
|
||||
pub const APP_ENV: &str = concatcp!(super::APP_ENV, " ", GENERAL_ERROR);
|
||||
pub const BACKEND_PORT: &str = concatcp!(super::BACKEND_PORT, " ", GENERAL_ERROR);
|
||||
pub const FRONTEND_URL: &str = concatcp!(super::FRONTEND_URL, " ", GENERAL_ERROR);
|
||||
|
||||
+21
-21
@@ -2,7 +2,7 @@
|
||||
mod tests {
|
||||
#[test]
|
||||
fn test_dburl() {
|
||||
let result = icarus_envy::environment::get_db_url();
|
||||
let result = sienvy::environment::get_db_url();
|
||||
assert_eq!(
|
||||
result.value, "postgres://myuser:password@localhost:5432/my_db",
|
||||
"DATABASE_URL does not match {:?}",
|
||||
@@ -12,7 +12,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_get_secret_main_key() {
|
||||
let result = icarus_envy::environment::get_secret_main_key();
|
||||
let result = sienvy::environment::get_secret_main_key();
|
||||
assert_eq!(
|
||||
result.value, "Somesupersecretpassword!!!45345435",
|
||||
"SECRET_MAIN_KEY does not match {:?}",
|
||||
@@ -22,7 +22,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_get_service_passphrase() {
|
||||
let result = icarus_envy::environment::get_service_passphrase();
|
||||
let result = sienvy::environment::get_service_passphrase();
|
||||
assert_eq!(
|
||||
result.value, "T5OCHDHadAtuOWIqRAS7u8XHDDkzKT1Uvvw7mGMkNzKjVdlHA8xGdILf2adDHspO",
|
||||
"SERVICE_PASSPHRASE does not match {:?}",
|
||||
@@ -32,7 +32,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_get_secret_key() {
|
||||
let result = icarus_envy::environment::get_secret_key();
|
||||
let result = sienvy::environment::get_secret_key();
|
||||
assert_eq!(
|
||||
result.value, "AmIGoodEnoughForYou?",
|
||||
"SECRET_KEY does not match {:?}",
|
||||
@@ -42,7 +42,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_get_root_directory() {
|
||||
let result = icarus_envy::environment::get_root_directory();
|
||||
let result = sienvy::environment::get_root_directory();
|
||||
assert_eq!(
|
||||
result.value, "/path/to/root",
|
||||
"ROOT_DIRECTORY does not match {:?}",
|
||||
@@ -51,68 +51,68 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_icarus_base_api_url() {
|
||||
let result = icarus_envy::environment::get_icarus_base_api_url();
|
||||
fn test_get_soaricarus_base_api_url() {
|
||||
let result = sienvy::environment::get_soaricarus_base_api_url();
|
||||
assert_eq!(
|
||||
result.value, "https://icarus.com",
|
||||
"ICARUS_BASE_API_URL does not match {:?}",
|
||||
result.value, "https://soaricarus.com",
|
||||
"SOARICARUS_BASE_API_URL does not match {:?}",
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_app_env() {
|
||||
let result = icarus_envy::environment::get_app_env();
|
||||
let result = sienvy::environment::get_app_env();
|
||||
assert_eq!(
|
||||
result.value,
|
||||
"development",
|
||||
"{} does not match {:?}",
|
||||
icarus_envy::keys::APP_ENV,
|
||||
sienvy::keys::APP_ENV,
|
||||
result
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_backend_port() {
|
||||
let result = icarus_envy::environment::get_backend_port();
|
||||
let result = sienvy::environment::get_backend_port();
|
||||
assert_eq!(
|
||||
result.value,
|
||||
"8001",
|
||||
"{} does not match {:?}",
|
||||
icarus_envy::keys::BACKEND_PORT,
|
||||
sienvy::keys::BACKEND_PORT,
|
||||
result
|
||||
)
|
||||
}
|
||||
#[test]
|
||||
fn test_get_frontend_url() {
|
||||
let result = icarus_envy::environment::get_frontend_url();
|
||||
let result = sienvy::environment::get_frontend_url();
|
||||
assert_eq!(
|
||||
result.value,
|
||||
"http://localhost:4200",
|
||||
"{} does not match {:?}",
|
||||
icarus_envy::keys::FRONTEND_URL,
|
||||
sienvy::keys::FRONTEND_URL,
|
||||
result
|
||||
)
|
||||
}
|
||||
#[test]
|
||||
fn test_get_rust_log() {
|
||||
let result = icarus_envy::environment::get_rust_log();
|
||||
let result = sienvy::environment::get_rust_log();
|
||||
assert_eq!(
|
||||
result.value,
|
||||
"debug",
|
||||
"{} does not match {:?}",
|
||||
icarus_envy::keys::RUST_LOG,
|
||||
sienvy::keys::RUST_LOG,
|
||||
result
|
||||
)
|
||||
}
|
||||
#[test]
|
||||
fn test_get_allowed_origins() {
|
||||
let result = icarus_envy::environment::get_allowed_origins();
|
||||
let result = sienvy::environment::get_allowed_origins();
|
||||
assert_eq!(
|
||||
result.value,
|
||||
"https://soaricarus.com,https://www.soaricarus.com",
|
||||
"{} does not match {:?}",
|
||||
icarus_envy::keys::ALLOWED_ORIGINS,
|
||||
sienvy::keys::ALLOWED_ORIGINS,
|
||||
result
|
||||
);
|
||||
|
||||
@@ -122,7 +122,7 @@ mod tests {
|
||||
result.key
|
||||
);
|
||||
|
||||
match icarus_envy::utility::delimitize(&result) {
|
||||
match sienvy::utility::delimitize(&result) {
|
||||
Ok(allowed_origins) => {
|
||||
assert_eq!(
|
||||
allowed_origins.len(),
|
||||
@@ -152,7 +152,7 @@ mod tests {
|
||||
];
|
||||
|
||||
for (key, value) in keys.iter() {
|
||||
let result = icarus_envy::environment::get_env(key);
|
||||
let result = sienvy::environment::get_env(key);
|
||||
assert_eq!(
|
||||
result.value, *value,
|
||||
"{:?} does not match {:?}",
|
||||
|
||||
Reference in New Issue
Block a user