Compare commits

..

6 Commits

Author SHA1 Message Date
bb04f4417d tsk-23: Rust version bump (#27)
All checks were successful
Release Tagging / release (push) Successful in 33s
Rust Build / Check (push) Successful in 30s
Rust Build / Test Suite (push) Successful in 31s
Rust Build / Rustfmt (push) Successful in 31s
Rust Build / Clippy (push) Successful in 31s
Rust Build / build (push) Successful in 30s
Close #23

Reviewed-on: #27
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-10-12 20:30:29 +00:00
6805b15f0e Dependency update (#26)
All checks were successful
Release Tagging / release (push) Successful in 30s
Rust Build / Check (push) Successful in 29s
Rust Build / Test Suite (push) Successful in 28s
Rust Build / Rustfmt (push) Successful in 5m32s
Rust Build / Clippy (push) Successful in 30s
Rust Build / build (push) Successful in 29s
Reviewed-on: #26
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-10-12 20:16:11 +00:00
8f0d123db5 tsk-22: Add function to parse env variable to a vector of strings (#25)
All checks were successful
Release Tagging / release (push) Successful in 33s
Rust Build / Check (push) Successful in 33s
Rust Build / Test Suite (push) Successful in 31s
Rust Build / Rustfmt (push) Successful in 31s
Rust Build / Clippy (push) Successful in 32s
Rust Build / build (push) Successful in 30s
Closes #22

Reviewed-on: #25
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-10-10 19:14:15 +00:00
38e0073cbe Added EnvVar (#24)
All checks were successful
Release Tagging / release (push) Successful in 34s
Rust Build / Check (push) Successful in 30s
Rust Build / Test Suite (push) Successful in 32s
Rust Build / Rustfmt (push) Successful in 31s
Rust Build / Clippy (push) Successful in 34s
Rust Build / build (push) Successful in 30s
Release Tagging / release (pull_request) Successful in 33s
Rust Build / Check (pull_request) Successful in 30s
Rust Build / Test Suite (pull_request) Successful in 31s
Rust Build / Rustfmt (pull_request) Successful in 32s
Rust Build / Clippy (pull_request) Successful in 35s
Rust Build / build (pull_request) Successful in 31s
Reviewed-on: #24
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-10-10 17:37:32 +00:00
86c5050c7b Refactoring (#21)
All checks were successful
Rust Build / Check (push) Successful in 33s
Rust Build / Test Suite (push) Successful in 37s
Release Tagging / release (push) Successful in 46s
Rust Build / Rustfmt (push) Successful in 34s
Rust Build / Clippy (push) Successful in 36s
Rust Build / build (push) Successful in 40s
Reviewed-on: #21
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-09-29 20:38:53 +00:00
0f470ef723 Added general environment function (#20)
All checks were successful
Rust Build / Check (push) Successful in 40s
Release Tagging / release (push) Successful in 45s
Rust Build / Test Suite (push) Successful in 34s
Rust Build / Rustfmt (push) Successful in 36s
Rust Build / Clippy (push) Successful in 42s
Rust Build / build (push) Successful in 36s
Reviewed-on: #20
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-09-29 19:22:10 +00:00
11 changed files with 350 additions and 222 deletions

7
.env
View File

@@ -1,3 +1,5 @@
RANDOM_ENV_KEY="YouDon'tWantToButYouGottaChange|It'sGoingToHurtYouTryingToStayTheSame|AreYouInItOrYouInItForTheFame?|I'mTryingToFigureOutWhoLoveMeForMe"
MODNAR_ENV_KEY="FeelingTheMonsterClimbDeepserInsideOfMe|FeelingHimGnawingMyHeartAwayHungrily|I'llNeverLoseThisPain|NeverDreamOfYouAgain"
SECRET_MAIN_KEY=Somesupersecretpassword!!!45345435
SECRET_KEY=AmIGoodEnoughForYou?
SERVICE_PASSPHRASE=T5OCHDHadAtuOWIqRAS7u8XHDDkzKT1Uvvw7mGMkNzKjVdlHA8xGdILf2adDHspO
@@ -9,3 +11,8 @@ 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
APP_ENV=development
BACKEND_PORT=8001
FRONTEND_URL=http://localhost:4200
RUST_LOG=debug
ALLOWED_ORIGINS=https://soaricarus.com,https://www.soaricarus.com

View File

@@ -1,3 +1,5 @@
RANDOM_ENV_KEY="YouDon'tWantToButYouGottaChange|It'sGoingToHurtYouTryingToStayTheSame|AreYouInItOrYouInItForTheFame?|I'mTryingToFigureOutWhoLoveMeForMe"
MODNAR_ENV_KEY="FeelingTheMonsterClimbDeepserInsideOfMe|FeelingHimGnawingMyHeartAwayHungrily|I'llNeverLoseThisPain|NeverDreamOfYouAgain"
SECRET_MAIN_KEY=Somesupersecretpassword!!!45345435
SECRET_KEY=AmIGoodEnoughForYou?
SERVICE_PASSPHRASE=T5OCHDHadAtuOWIqRAS7u8XHDDkzKT1Uvvw7mGMkNzKjVdlHA8xGdILf2adDHspO
@@ -9,3 +11,8 @@ 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
APP_ENV=development
BACKEND_PORT=8001
FRONTEND_URL=http://localhost:4200
RUST_LOG=debug
ALLOWED_ORIGINS=https://soaricarus.com,https://www.soaricarus.com

View File

@@ -13,14 +13,14 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
fetch-depth: 0 # Important for git describe --tags
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.88.0
toolchain: 1.90.0
components: cargo
- name: Extract Version from Cargo.toml

View File

@@ -13,30 +13,30 @@ jobs:
name: Check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.88.0
toolchain: 1.90.0
- run: cargo check
test:
name: Test Suite
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.88.0
toolchain: 1.90.0
- run: cargo test
fmt:
name: Rustfmt
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.88.0
toolchain: 1.90.0
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check
@@ -44,10 +44,10 @@ jobs:
name: Clippy
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.88.0
toolchain: 1.90.0
- run: rustup component add clippy
- run: cargo clippy -- -D warnings
@@ -55,8 +55,8 @@ jobs:
name: build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.88.0
toolchain: 1.90.0
- run: cargo build

250
Cargo.lock generated
View File

@@ -15,9 +15,9 @@ dependencies = [
[[package]]
name = "async-channel"
version = "2.3.1"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a"
checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2"
dependencies = [
"concurrent-queue",
"event-listener-strategy",
@@ -27,9 +27,9 @@ dependencies = [
[[package]]
name = "async-executor"
version = "1.13.2"
version = "1.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb812ffb58524bdd10860d7d974e2f01cc0950c2438a74ee5ec2e2280c6c4ffa"
checksum = "497c00e0fd83a72a79a39fcbd8e3e2f055d6f6c7e025f3b3d91f4f8e76527fb8"
dependencies = [
"async-task",
"concurrent-queue",
@@ -45,7 +45,7 @@ version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c"
dependencies = [
"async-channel 2.3.1",
"async-channel 2.5.0",
"async-executor",
"async-io",
"async-lock",
@@ -56,11 +56,11 @@ dependencies = [
[[package]]
name = "async-io"
version = "2.4.1"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1237c0ae75a0f3765f58910ff9cdd0a12eeb39ab2f4c7de23262f337f0aacbb3"
checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc"
dependencies = [
"async-lock",
"autocfg",
"cfg-if",
"concurrent-queue",
"futures-io",
@@ -69,26 +69,25 @@ dependencies = [
"polling",
"rustix",
"slab",
"tracing",
"windows-sys",
]
[[package]]
name = "async-lock"
version = "3.4.0"
version = "3.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18"
checksum = "5fd03604047cee9b6ce9de9f70c6cd540a0520c813cbd49bae61f33ab80ed1dc"
dependencies = [
"event-listener 5.4.0",
"event-listener 5.4.1",
"event-listener-strategy",
"pin-project-lite",
]
[[package]]
name = "async-std"
version = "1.13.1"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "730294c1c08c2e0f85759590518f6333f0d5a0a766a27d519c1b244c3dfd8a24"
checksum = "2c8e079a4ab67ae52b7403632e4618815d6db36d2a010cfe41b02c1b1578f93b"
dependencies = [
"async-channel 1.9.0",
"async-global-executor",
@@ -124,23 +123,23 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "autocfg"
version = "1.4.0"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "bitflags"
version = "2.9.1"
version = "2.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"
[[package]]
name = "blocking"
version = "1.6.1"
version = "1.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea"
checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21"
dependencies = [
"async-channel 2.3.1",
"async-channel 2.5.0",
"async-task",
"futures-io",
"futures-lite",
@@ -149,15 +148,15 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.17.0"
version = "3.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43"
[[package]]
name = "cfg-if"
version = "1.0.0"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9"
[[package]]
name = "concurrent-queue"
@@ -170,9 +169,9 @@ dependencies = [
[[package]]
name = "const_format"
version = "0.2.34"
version = "0.2.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd"
checksum = "7faa7469a93a566e9ccc1c73fe783b4a65c274c5ace346038dca9c39fe0030ad"
dependencies = [
"const_format_proc_macros",
]
@@ -202,9 +201,9 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
[[package]]
name = "errno"
version = "0.3.12"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys",
@@ -218,9 +217,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "event-listener"
version = "5.4.0"
version = "5.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae"
checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab"
dependencies = [
"concurrent-queue",
"parking",
@@ -233,7 +232,7 @@ version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
dependencies = [
"event-listener 5.4.0",
"event-listener 5.4.1",
"pin-project-lite",
]
@@ -266,9 +265,9 @@ checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
[[package]]
name = "futures-lite"
version = "2.6.0"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532"
checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"
dependencies = [
"fastrand",
"futures-core",
@@ -291,13 +290,13 @@ dependencies = [
[[package]]
name = "hermit-abi"
version = "0.5.1"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08"
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
[[package]]
name = "icarus_envy"
version = "0.3.3"
version = "0.5.0"
dependencies = [
"async-std",
"const_format",
@@ -306,9 +305,9 @@ dependencies = [
[[package]]
name = "js-sys"
version = "0.3.77"
version = "0.3.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305"
dependencies = [
"once_cell",
"wasm-bindgen",
@@ -325,30 +324,30 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.172"
version = "0.2.177"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"
[[package]]
name = "linux-raw-sys"
version = "0.9.4"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"
[[package]]
name = "log"
version = "0.4.27"
version = "0.4.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
dependencies = [
"value-bag",
]
[[package]]
name = "memchr"
version = "2.7.4"
version = "2.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
[[package]]
name = "once_cell"
@@ -387,42 +386,41 @@ dependencies = [
[[package]]
name = "polling"
version = "3.8.0"
version = "3.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b53a684391ad002dd6a596ceb6c74fd004fdce75f4be2e3f615068abbea5fd50"
checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218"
dependencies = [
"cfg-if",
"concurrent-queue",
"hermit-abi",
"pin-project-lite",
"rustix",
"tracing",
"windows-sys",
]
[[package]]
name = "proc-macro2"
version = "1.0.95"
version = "1.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778"
checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.40"
version = "1.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rustix"
version = "1.0.7"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266"
checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e"
dependencies = [
"bitflags",
"errno",
@@ -433,51 +431,32 @@ dependencies = [
[[package]]
name = "rustversion"
version = "1.0.21"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
[[package]]
name = "slab"
version = "0.4.9"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [
"autocfg",
]
checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
[[package]]
name = "syn"
version = "2.0.101"
version = "2.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "tracing"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
dependencies = [
"pin-project-lite",
"tracing-core",
]
[[package]]
name = "tracing-core"
version = "0.1.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c"
[[package]]
name = "unicode-ident"
version = "1.0.18"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
[[package]]
name = "unicode-xid"
@@ -493,21 +472,22 @@ checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5"
[[package]]
name = "wasm-bindgen"
version = "0.2.100"
version = "0.2.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d"
dependencies = [
"cfg-if",
"once_cell",
"rustversion",
"wasm-bindgen-macro",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.100"
version = "0.2.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19"
dependencies = [
"bumpalo",
"log",
@@ -519,9 +499,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.50"
version = "0.4.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61"
checksum = "7e038d41e478cc73bae0ff9b36c60cff1c98b8f38f8d7e8061e79ee63608ac5c"
dependencies = [
"cfg-if",
"js-sys",
@@ -532,9 +512,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.100"
version = "0.2.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -542,9 +522,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.100"
version = "0.2.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7"
dependencies = [
"proc-macro2",
"quote",
@@ -555,92 +535,34 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.100"
version = "0.2.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1"
dependencies = [
"unicode-ident",
]
[[package]]
name = "web-sys"
version = "0.3.77"
version = "0.3.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "windows-link"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
[[package]]
name = "windows-sys"
version = "0.59.0"
version = "0.61.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
dependencies = [
"windows-targets",
"windows-link",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"

View File

@@ -1,12 +1,12 @@
[package]
name = "icarus_envy"
version = "0.3.3"
version = "0.5.0"
edition = "2024"
rust-version = "1.88"
rust-version = "1.90"
[dependencies]
dotenvy = { version = "0.15.7" }
const_format = { version = "0.2.34" }
const_format = { version = "0.2.35" }
[dev-dependencies]
async-std = { version = "1.13.1" }
async-std = { version = "1.13.2" }

View File

@@ -1,67 +1,106 @@
pub async fn get_db_url() -> String {
pub async fn get_db_url() -> crate::EnvVar {
dotenvy::dotenv().ok();
std::env::var(crate::keys::DB_URL).expect(crate::keys::error::DB_URL)
let key = crate::keys::DB_URL;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub async fn get_secret_main_key() -> String {
pub async fn get_secret_main_key() -> crate::EnvVar {
dotenvy::dotenv().ok();
std::env::var(crate::keys::SECRET_MAIN_KEY).expect(crate::keys::error::SECRET_MAIN_KEY)
let key = crate::keys::SECRET_MAIN_KEY;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub async fn get_service_passphrase() -> String {
pub async fn get_service_passphrase() -> crate::EnvVar {
dotenvy::dotenv().ok();
std::env::var(crate::keys::SERVICE_PASSPHRASE).expect(crate::keys::error::SERVICE_LOGIN)
let key = crate::keys::SERVICE_PASSPHRASE;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub async fn get_secret_key() -> String {
pub async fn get_secret_key() -> crate::EnvVar {
dotenvy::dotenv().ok();
std::env::var(crate::keys::SECRET_KEY).expect(crate::keys::error::SECRET_KEY)
let key = crate::keys::SECRET_KEY;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub async fn get_root_directory() -> String {
pub async fn get_root_directory() -> crate::EnvVar {
dotenvy::dotenv().ok();
std::env::var(crate::keys::ROOT_DIRECTORY).expect(crate::keys::error::ROOT_DIRECTORY)
let key = crate::keys::ROOT_DIRECTORY;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub async fn get_icarus_base_api_url() -> String {
pub async fn get_icarus_base_api_url() -> crate::EnvVar {
dotenvy::dotenv().ok();
std::env::var(crate::keys::ICARUS_BASE_API_URL).expect(crate::keys::error::ICARUS_BASE_API_URL)
let key = crate::keys::ICARUS_BASE_API_URL;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub async fn get_icarus_auth_base_api_url() -> String {
pub async fn get_icarus_auth_base_api_url() -> crate::EnvVar {
dotenvy::dotenv().ok();
std::env::var(crate::keys::ICARUS_AUTH_BASE_API_URL)
.expect(crate::keys::error::ICARUS_AUTH_BASE_API_URL)
let key = crate::keys::ICARUS_AUTH_BASE_API_URL;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub async fn get_app_env() -> String {
pub async fn get_app_env() -> crate::EnvVar {
dotenvy::dotenv().ok();
std::env::var(crate::keys::APP_ENV).expect(crate::keys::error::APP_ENV)
let key = crate::keys::APP_ENV;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub async fn get_backend_port() -> String {
pub async fn get_backend_port() -> crate::EnvVar {
dotenvy::dotenv().ok();
std::env::var(crate::keys::BACKEND_PORT).expect(crate::keys::error::BACKEND_PORT)
let key = crate::keys::BACKEND_PORT;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub async fn get_frontend_url() -> String {
pub async fn get_frontend_url() -> crate::EnvVar {
dotenvy::dotenv().ok();
std::env::var(crate::keys::FRONTEND_URL).expect(crate::keys::error::FRONTEND_URL)
let key = crate::keys::FRONTEND_URL;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub async fn get_rust_log() -> String {
pub async fn get_rust_log() -> crate::EnvVar {
dotenvy::dotenv().ok();
std::env::var(crate::keys::RUST_LOG).expect(crate::keys::error::RUST_LOG)
let key = crate::keys::RUST_LOG;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub async fn get_allowed_origins() -> String {
pub async fn get_allowed_origins() -> crate::EnvVar {
dotenvy::dotenv().ok();
std::env::var(crate::keys::ALLOWED_ORIGINS).expect(crate::keys::error::ALLOWED_ORIGINS)
let key = crate::keys::ALLOWED_ORIGINS;
let value = std::env::var(key).expect(key);
let mut envvar = crate::init_envvar(key, &value);
crate::init_delimiter(&mut envvar, ',');
envvar
}
/// Get environment not specified in the code
pub async fn get_env(environment: &str) -> String {
pub async fn get_env(environment: &str) -> crate::EnvVar {
dotenvy::dotenv().ok();
let my_error = format!("{environment} {}", crate::keys::error::GENERAL_ERROR);
std::env::var(environment).expect(&my_error)
let value = std::env::var(environment).expect(&my_error);
crate::init_envvar(environment, &value)
}

View File

@@ -1,24 +1,24 @@
// Environment key for Database management
/// Environment key for Database management
pub const DB_URL: &str = "DATABASE_URL";
// Environment key for secret main key
// Used for the icarus app
/// Environment key for secret main key
/// Used for the icarus app
pub const SECRET_MAIN_KEY: &str = "SECRET_MAIN_KEY";
// Environment key for service logins
/// Environment key for service logins
pub const SERVICE_PASSPHRASE: &str = "SERVICE_PASSPHRASE";
// Environment key for secret key
// Generic use of secret key that could be found in various apps
/// Environment key for secret key
/// 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 icarus app
pub const ROOT_DIRECTORY: &str = "ROOT_DIRECTORY";
// Environment key for icarus api url
/// Environment key for icarus api url
pub const ICARUS_BASE_API_URL: &str = "ICARUS_BASE_API_URL";
// Environment key for icarus auth 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 App status

View File

@@ -1,2 +1,39 @@
pub mod environment;
pub mod keys;
pub mod utility;
#[derive(Debug, Default, Clone)]
pub struct EnvVar {
pub key: String,
pub value: String,
pub has_delimiter: bool,
pub delimiter: char,
}
pub fn init_envvar(key: &str, value: &str) -> EnvVar {
EnvVar {
key: key.to_string(),
value: value.to_string(),
has_delimiter: false,
..Default::default()
}
}
pub fn init_delimiter(envvar: &mut EnvVar, delimiter: char) {
let mut amount_of_delimiters_found: i32 = 0;
for v in envvar.value.chars() {
if v == delimiter {
amount_of_delimiters_found += 1;
}
}
let has_delimiter = amount_of_delimiters_found >= 1;
if has_delimiter {
envvar.has_delimiter = has_delimiter;
envvar.delimiter = delimiter;
} else {
envvar.has_delimiter = has_delimiter;
}
}

15
src/utility.rs Normal file
View File

@@ -0,0 +1,15 @@
/// Take the Environment variable and delimitize it. If the value has a delimiter,
/// extract it into some strings
pub fn delimitize(var: &crate::EnvVar) -> Result<Vec<String>, std::io::Error> {
if var.has_delimiter {
Ok(var
.value
.split(var.delimiter)
.map(|c| c.parse::<String>().unwrap())
.collect())
} else {
Err(std::io::Error::other(
"Environment variable does not have a delimiter",
))
}
}

View File

@@ -4,7 +4,7 @@ mod tests {
fn test_dburl() {
let result = async_std::task::block_on(icarus_envy::environment::get_db_url());
assert_eq!(
result, "postgres://myuser:password@localhost:5432/my_db",
result.value, "postgres://myuser:password@localhost:5432/my_db",
"DATABASE_URL does not match {:?}",
result
);
@@ -14,7 +14,7 @@ mod tests {
fn test_get_secret_main_key() {
let result = async_std::task::block_on(icarus_envy::environment::get_secret_main_key());
assert_eq!(
result, "Somesupersecretpassword!!!45345435",
result.value, "Somesupersecretpassword!!!45345435",
"SECRET_MAIN_KEY does not match {:?}",
result
)
@@ -24,7 +24,7 @@ mod tests {
fn test_get_service_passphrase() {
let result = async_std::task::block_on(icarus_envy::environment::get_service_passphrase());
assert_eq!(
result, "T5OCHDHadAtuOWIqRAS7u8XHDDkzKT1Uvvw7mGMkNzKjVdlHA8xGdILf2adDHspO",
result.value, "T5OCHDHadAtuOWIqRAS7u8XHDDkzKT1Uvvw7mGMkNzKjVdlHA8xGdILf2adDHspO",
"SERVICE_PASSPHRASE does not match {:?}",
result
)
@@ -34,7 +34,7 @@ mod tests {
fn test_get_secret_key() {
let result = async_std::task::block_on(icarus_envy::environment::get_secret_key());
assert_eq!(
result, "AmIGoodEnoughForYou?",
result.value, "AmIGoodEnoughForYou?",
"SECRET_KEY does not match {:?}",
result
)
@@ -44,7 +44,7 @@ mod tests {
fn test_get_root_directory() {
let result = async_std::task::block_on(icarus_envy::environment::get_root_directory());
assert_eq!(
result, "/path/to/root",
result.value, "/path/to/root",
"ROOT_DIRECTORY does not match {:?}",
result
)
@@ -54,9 +54,110 @@ mod tests {
fn test_get_icarus_base_api_url() {
let result = async_std::task::block_on(icarus_envy::environment::get_icarus_base_api_url());
assert_eq!(
result, "https://icarus.com",
result.value, "https://icarus.com",
"ICARUS_BASE_API_URL does not match {:?}",
result
)
}
#[test]
fn test_get_app_env() {
let result = async_std::task::block_on(icarus_envy::environment::get_app_env());
assert_eq!(
result.value,
"development",
"{} does not match {:?}",
icarus_envy::keys::APP_ENV,
result
)
}
#[test]
fn test_get_backend_port() {
let result = async_std::task::block_on(icarus_envy::environment::get_backend_port());
assert_eq!(
result.value,
"8001",
"{} does not match {:?}",
icarus_envy::keys::BACKEND_PORT,
result
)
}
#[test]
fn test_get_frontend_url() {
let result = async_std::task::block_on(icarus_envy::environment::get_frontend_url());
assert_eq!(
result.value,
"http://localhost:4200",
"{} does not match {:?}",
icarus_envy::keys::FRONTEND_URL,
result
)
}
#[test]
fn test_get_rust_log() {
let result = async_std::task::block_on(icarus_envy::environment::get_rust_log());
assert_eq!(
result.value,
"debug",
"{} does not match {:?}",
icarus_envy::keys::RUST_LOG,
result
)
}
#[test]
fn test_get_allowed_origins() {
let result = async_std::task::block_on(icarus_envy::environment::get_allowed_origins());
assert_eq!(
result.value,
"https://soaricarus.com,https://www.soaricarus.com",
"{} does not match {:?}",
icarus_envy::keys::ALLOWED_ORIGINS,
result
);
assert_eq!(
result.has_delimiter, true,
"The {} variable has an issue finding the delimiter",
result.key
);
match icarus_envy::utility::delimitize(&result) {
Ok(allowed_origins) => {
assert_eq!(
allowed_origins.len(),
2,
"The amount of allowed origins does not match. {} {}",
allowed_origins.len(),
2
)
}
Err(err) => {
assert!(false, "Error: {:?}", err)
}
}
}
#[test]
fn test_get_env() {
let keys = vec![
(
"RANDOM_ENV_KEY",
"YouDon'tWantToButYouGottaChange|It'sGoingToHurtYouTryingToStayTheSame|AreYouInItOrYouInItForTheFame?|I'mTryingToFigureOutWhoLoveMeForMe",
),
(
"MODNAR_ENV_KEY",
"FeelingTheMonsterClimbDeepserInsideOfMe|FeelingHimGnawingMyHeartAwayHungrily|I'llNeverLoseThisPain|NeverDreamOfYouAgain",
),
];
for (key, value) in keys.iter() {
let result = async_std::task::block_on(icarus_envy::environment::get_env(key));
assert_eq!(
result.value, *value,
"{:?} does not match {:?}",
key, result
)
}
}
}