Compare commits

...
Author SHA1 Message Date
phoenix d06c8fdf49 Name change (#3)
sienvy Build / Check (push) Successful in 26s
sienvy Build / Test Suite (push) Successful in 25s
sienvy Build / Rustfmt (push) Successful in 37s
Release Tagging / release (push) Successful in 2m52s
sienvy Build / Clippy (push) Successful in 2m44s
sienvy Build / build (push) Successful in 2m34s
Reviewed-on: #3
2026-07-14 16:33:01 -04:00
phoenix 349056db6e Removing async (#2)
Release Tagging / release (push) Successful in 45s
Rust Build / Test Suite (push) Successful in 48s
Rust Build / Check (push) Successful in 57s
Rust Build / Rustfmt (push) Successful in 53s
Rust Build / Clippy (push) Successful in 53s
Rust Build / build (push) Successful in 55s
Reviewed-on: phoenix/icarus_envy#2
2026-07-07 16:38:20 -04:00
phoenix 208539f559 Update (#1)
Release Tagging / release (push) Successful in 44s
Rust Build / Check (push) Successful in 55s
Rust Build / Test Suite (push) Successful in 1m0s
Rust Build / Rustfmt (push) Successful in 55s
Rust Build / Clippy (push) Successful in 54s
Rust Build / build (push) Successful in 1m2s
Reviewed-on: phoenix/icarus_envy#1
2026-07-07 16:27:26 -04:00
phoenixandphoenix ab91c3fa4f update rust (#29)
Release Tagging / release (pull_request) Successful in 36s
Rust Build / Check (pull_request) Successful in 47s
Rust Build / Rustfmt (pull_request) Successful in 35s
Rust Build / Test Suite (pull_request) Successful in 1m14s
Rust Build / build (pull_request) Successful in 32s
Rust Build / Clippy (pull_request) Successful in 1m57s
Reviewed-on: phoenix/icarus_envy#29
Co-authored-by: phoenix <mail@kundeng.us>
Co-committed-by: phoenix <mail@kundeng.us>
2026-05-03 18:20:00 -04:00
phoenixandphoenix b315e89480 Update rust (#28)
Reviewed-on: phoenix/icarus_envy#28
Co-authored-by: phoenix <mail@kundeng.us>
Co-committed-by: phoenix <mail@kundeng.us>
2026-03-22 15:41:04 -04:00
phoenixandphoenix bb04f4417d tsk-23: Rust version bump (#27)
Close #23

Reviewed-on: phoenix/icarus_envy#27
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-10-12 20:30:29 +00:00
phoenixandphoenix 6805b15f0e Dependency update (#26)
Reviewed-on: phoenix/icarus_envy#26
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-10-12 20:16:11 +00:00
phoenixandphoenix 8f0d123db5 tsk-22: Add function to parse env variable to a vector of strings (#25)
Closes #22

Reviewed-on: phoenix/icarus_envy#25
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-10-10 19:14:15 +00:00
phoenixandphoenix 38e0073cbe Added EnvVar (#24)
Reviewed-on: phoenix/icarus_envy#24
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-10-10 17:37:32 +00:00
phoenixandphoenix 86c5050c7b Refactoring (#21)
Reviewed-on: phoenix/icarus_envy#21
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-09-29 20:38:53 +00:00
phoenixandphoenix 0f470ef723 Added general environment function (#20)
Reviewed-on: phoenix/icarus_envy#20
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-09-29 19:22:10 +00:00
phoenixandphoenix e51df82f09 CORS env variables (#19)
Reviewed-on: phoenix/icarus_envy#19
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-09-28 23:08:32 +00:00
phoenixandphoenix d84a8144ae tsk-17: Add ICARUS_AUTH_BASE_API_URL env key (#18)
Closes #17

Reviewed-on: phoenix/icarus_envy#18
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-08-14 22:58:45 +00:00
phoenixandphoenix 3cd42dab6b Service passphrase (#16)
Reviewed-on: phoenix/icarus_envy#16
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-08-02 21:26:14 +00:00
phoenixandphoenix e2c83b5219 Removing references of the devel branch (#15)
Reviewed-on: phoenix/icarus_envy#15
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-08-02 21:14:25 +00:00
phoenix b414031af0 v0.3 release (#9)
Reviewed-on: phoenix/icarus_envy#9
2025-07-23 22:04:06 +00:00
phoenixandphoenix d73fba9899 Version bump (#14)
Reviewed-on: phoenix/icarus_envy#14
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-06-29 19:06:18 +00:00
phoenixandphoenix 020d091446 Rust std change (#13)
Reviewed-on: phoenix/icarus_envy#13
Co-authored-by: phoenix <kundeng00@pm.me>
Co-committed-by: phoenix <kundeng00@pm.me>
2025-06-29 18:58:12 +00:00
phoenix 3ee8c1e573 Stable release (#5)
Reviewed-on: phoenix/icarus_envy#5
2025-06-02 00:13:57 +00:00
phoenix 9aa16a3f2e First release (#2)
Reviewed-on: phoenix/icarus_envy#2
2025-05-29 22:55:19 +00:00
13 changed files with 394 additions and 640 deletions
+10 -1
View File
@@ -1,9 +1,18 @@
RANDOM_ENV_KEY="YouDon'tWantToButYouGottaChange|It'sGoingToHurtYouTryingToStayTheSame|AreYouInItOrYouInItForTheFame?|I'mTryingToFigureOutWhoLoveMeForMe"
MODNAR_ENV_KEY="FeelingTheMonsterClimbDeepserInsideOfMe|FeelingHimGnawingMyHeartAwayHungrily|I'llNeverLoseThisPain|NeverDreamOfYouAgain"
SECRET_MAIN_KEY=Somesupersecretpassword!!!45345435 SECRET_MAIN_KEY=Somesupersecretpassword!!!45345435
SECRET_KEY=AmIGoodEnoughForYou? SECRET_KEY=AmIGoodEnoughForYou?
SERVICE_PASSPHRASE=T5OCHDHadAtuOWIqRAS7u8XHDDkzKT1Uvvw7mGMkNzKjVdlHA8xGdILf2adDHspO
ROOT_DIRECTORY=/path/to/root ROOT_DIRECTORY=/path/to/root
POSTGRES_MAIN_USER=myuser POSTGRES_MAIN_USER=myuser
POSTGRES_MAIN_PASSWORD=password POSTGRES_MAIN_PASSWORD=password
POSTGRES_MAIN_DB=my_db POSTGRES_MAIN_DB=my_db
POSTGRES_MAIN_HOST=localhost POSTGRES_MAIN_HOST=localhost
DATABASE_URL=postgres://${POSTGRES_MAIN_USER}:${POSTGRES_MAIN_PASSWORD}@${POSTGRES_MAIN_HOST}:5432/${POSTGRES_MAIN_DB} DATABASE_URL=postgres://${POSTGRES_MAIN_USER}:${POSTGRES_MAIN_PASSWORD}@${POSTGRES_MAIN_HOST}:5432/${POSTGRES_MAIN_DB}
ICARUS_BASE_API_URL=https://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
RUST_LOG=debug
ALLOWED_ORIGINS=https://soaricarus.com,https://www.soaricarus.com
+10 -1
View File
@@ -1,9 +1,18 @@
RANDOM_ENV_KEY="YouDon'tWantToButYouGottaChange|It'sGoingToHurtYouTryingToStayTheSame|AreYouInItOrYouInItForTheFame?|I'mTryingToFigureOutWhoLoveMeForMe"
MODNAR_ENV_KEY="FeelingTheMonsterClimbDeepserInsideOfMe|FeelingHimGnawingMyHeartAwayHungrily|I'llNeverLoseThisPain|NeverDreamOfYouAgain"
SECRET_MAIN_KEY=Somesupersecretpassword!!!45345435 SECRET_MAIN_KEY=Somesupersecretpassword!!!45345435
SECRET_KEY=AmIGoodEnoughForYou? SECRET_KEY=AmIGoodEnoughForYou?
SERVICE_PASSPHRASE=T5OCHDHadAtuOWIqRAS7u8XHDDkzKT1Uvvw7mGMkNzKjVdlHA8xGdILf2adDHspO
ROOT_DIRECTORY=/path/to/root ROOT_DIRECTORY=/path/to/root
POSTGRES_MAIN_USER=myuser POSTGRES_MAIN_USER=myuser
POSTGRES_MAIN_PASSWORD=password POSTGRES_MAIN_PASSWORD=password
POSTGRES_MAIN_DB=my_db POSTGRES_MAIN_DB=my_db
POSTGRES_MAIN_HOST=localhost POSTGRES_MAIN_HOST=localhost
DATABASE_URL=postgres://${POSTGRES_MAIN_USER}:${POSTGRES_MAIN_PASSWORD}@${POSTGRES_MAIN_HOST}:5432/${POSTGRES_MAIN_DB} DATABASE_URL=postgres://${POSTGRES_MAIN_USER}:${POSTGRES_MAIN_PASSWORD}@${POSTGRES_MAIN_HOST}:5432/${POSTGRES_MAIN_DB}
ICARUS_BASE_API_URL=https://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
RUST_LOG=debug
ALLOWED_ORIGINS=https://soaricarus.com,https://www.soaricarus.com
+7 -3
View File
@@ -3,22 +3,26 @@ name: Release Tagging
on: on:
push: push:
branches: branches:
- devel - main
pull_request:
branches:
- main
jobs: jobs:
release: release:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v6
with: with:
fetch-depth: 0 # Important for git describe --tags fetch-depth: 0 # Important for git describe --tags
- name: Install Rust - name: Install Rust
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
toolchain: 1.86.0 toolchain: 1.97
components: cargo components: cargo
- uses: Swatinem/rust-cache@v2
- name: Extract Version from Cargo.toml - name: Extract Version from Cargo.toml
id: version id: version
+16 -14
View File
@@ -1,65 +1,67 @@
name: Rust Build name: sienvy Build
on: on:
push: push:
branches: branches:
- main - main
- devel
pull_request: pull_request:
branches: branches:
- main - main
- devel
jobs: jobs:
check: check:
name: Check name: Check
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.86.0 toolchain: 1.97
- uses: Swatinem/rust-cache@v2
- run: cargo check - run: cargo check
test: test:
name: Test Suite name: Test Suite
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.86.0 toolchain: 1.97
- uses: Swatinem/rust-cache@v2
- run: cargo test - run: cargo test
fmt: fmt:
name: Rustfmt name: Rustfmt
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.86.0 toolchain: 1.97
- run: rustup component add rustfmt - run: rustup component add rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check - run: cargo fmt --all -- --check
clippy: clippy:
name: Clippy name: Clippy
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.86.0 toolchain: 1.97
- run: rustup component add clippy - run: rustup component add clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy -- -D warnings - run: cargo clippy -- -D warnings
build: build:
name: build name: build
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1 - uses: actions-rust-lang/setup-rust-toolchain@v1
with: with:
toolchain: 1.86.0 toolchain: 1.97
- uses: Swatinem/rust-cache@v2
- run: cargo build - run: cargo build
Generated
+20 -583
View File
@@ -2,179 +2,14 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 4 version = 4
[[package]]
name = "async-channel"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35"
dependencies = [
"concurrent-queue",
"event-listener 2.5.3",
"futures-core",
]
[[package]]
name = "async-channel"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a"
dependencies = [
"concurrent-queue",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-executor"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb812ffb58524bdd10860d7d974e2f01cc0950c2438a74ee5ec2e2280c6c4ffa"
dependencies = [
"async-task",
"concurrent-queue",
"fastrand",
"futures-lite",
"pin-project-lite",
"slab",
]
[[package]]
name = "async-global-executor"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c"
dependencies = [
"async-channel 2.3.1",
"async-executor",
"async-io",
"async-lock",
"blocking",
"futures-lite",
"once_cell",
]
[[package]]
name = "async-io"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1237c0ae75a0f3765f58910ff9cdd0a12eeb39ab2f4c7de23262f337f0aacbb3"
dependencies = [
"async-lock",
"cfg-if",
"concurrent-queue",
"futures-io",
"futures-lite",
"parking",
"polling",
"rustix",
"slab",
"tracing",
"windows-sys",
]
[[package]]
name = "async-lock"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18"
dependencies = [
"event-listener 5.4.0",
"event-listener-strategy",
"pin-project-lite",
]
[[package]]
name = "async-std"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "730294c1c08c2e0f85759590518f6333f0d5a0a766a27d519c1b244c3dfd8a24"
dependencies = [
"async-channel 1.9.0",
"async-global-executor",
"async-io",
"async-lock",
"crossbeam-utils",
"futures-channel",
"futures-core",
"futures-io",
"futures-lite",
"gloo-timers",
"kv-log-macro",
"log",
"memchr",
"once_cell",
"pin-project-lite",
"pin-utils",
"slab",
"wasm-bindgen-futures",
]
[[package]]
name = "async-task"
version = "4.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de"
[[package]]
name = "atomic-waker"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "autocfg"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "bitflags"
version = "2.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967"
[[package]]
name = "blocking"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea"
dependencies = [
"async-channel 2.3.1",
"async-task",
"futures-io",
"futures-lite",
"piper",
]
[[package]]
name = "bumpalo"
version = "3.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "concurrent-queue"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
dependencies = [
"crossbeam-utils",
]
[[package]] [[package]]
name = "const_format" name = "const_format"
version = "0.2.34" version = "0.2.36"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" checksum = "4481a617ad9a412be3b97c5d403fef8ed023103368908b9c50af598ff467cc1e"
dependencies = [ dependencies = [
"const_format_proc_macros", "const_format_proc_macros",
"konst",
] ]
[[package]] [[package]]
@@ -188,12 +23,6 @@ dependencies = [
"unicode-xid", "unicode-xid",
] ]
[[package]]
name = "crossbeam-utils"
version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]] [[package]]
name = "dotenvy" name = "dotenvy"
version = "0.15.7" version = "0.15.7"
@@ -201,446 +30,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
[[package]] [[package]]
name = "errno" name = "konst"
version = "0.3.12" version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" checksum = "128133ed7824fcd73d6e7b17957c5eb7bacb885649bd8c69708b2331a10bcefb"
dependencies = [ dependencies = [
"libc", "konst_macro_rules",
"windows-sys",
] ]
[[package]] [[package]]
name = "event-listener" name = "konst_macro_rules"
version = "2.5.3" version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" checksum = "a4933f3f57a8e9d9da04db23fb153356ecaf00cbd14aee46279c33dc80925c37"
[[package]]
name = "event-listener"
version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae"
dependencies = [
"concurrent-queue",
"parking",
"pin-project-lite",
]
[[package]]
name = "event-listener-strategy"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
dependencies = [
"event-listener 5.4.0",
"pin-project-lite",
]
[[package]]
name = "fastrand"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
name = "futures-channel"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
dependencies = [
"futures-core",
]
[[package]]
name = "futures-core"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
[[package]]
name = "futures-io"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
[[package]]
name = "futures-lite"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"parking",
"pin-project-lite",
]
[[package]]
name = "gloo-timers"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994"
dependencies = [
"futures-channel",
"futures-core",
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "hermit-abi"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08"
[[package]]
name = "icarus_envy"
version = "0.2.1"
dependencies = [
"async-std",
"const_format",
"dotenvy",
]
[[package]]
name = "js-sys"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
dependencies = [
"once_cell",
"wasm-bindgen",
]
[[package]]
name = "kv-log-macro"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"
dependencies = [
"log",
]
[[package]]
name = "libc"
version = "0.2.172"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
[[package]]
name = "linux-raw-sys"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12"
[[package]]
name = "log"
version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
dependencies = [
"value-bag",
]
[[package]]
name = "memchr"
version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "once_cell"
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "parking"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba"
[[package]]
name = "pin-project-lite"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "piper"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066"
dependencies = [
"atomic-waker",
"fastrand",
"futures-io",
]
[[package]]
name = "polling"
version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b53a684391ad002dd6a596ceb6c74fd004fdce75f4be2e3f615068abbea5fd50"
dependencies = [
"cfg-if",
"concurrent-queue",
"hermit-abi",
"pin-project-lite",
"rustix",
"tracing",
"windows-sys",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.95" version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.40" version = "1.0.46"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" checksum = "dfbc457d0c7a0759a614551b11a6409e5951f6c7537be1f1b7682b9ae9230368"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]] [[package]]
name = "rustix" name = "sienvy"
version = "1.0.7" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266"
dependencies = [ dependencies = [
"bitflags", "const_format",
"errno", "dotenvy",
"libc",
"linux-raw-sys",
"windows-sys",
] ]
[[package]]
name = "rustversion"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
[[package]]
name = "slab"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [
"autocfg",
]
[[package]]
name = "syn"
version = "2.0.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
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]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.18" version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.2.6" version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853"
[[package]]
name = "value-bag"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5"
[[package]]
name = "wasm-bindgen"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
dependencies = [
"cfg-if",
"once_cell",
"rustversion",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
dependencies = [
"bumpalo",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
version = "0.4.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61"
dependencies = [
"cfg-if",
"js-sys",
"once_cell",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
dependencies = [
"unicode-ident",
]
[[package]]
name = "web-sys"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "windows-sys"
version = "0.59.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
"windows-targets",
]
[[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"
+4 -5
View File
@@ -1,12 +1,11 @@
[package] [package]
name = "icarus_envy" name = "sienvy"
version = "0.2.2" version = "0.8.0"
edition = "2024" edition = "2024"
rust-version = "1.86" rust-version = "1.95"
[dependencies] [dependencies]
dotenvy = { version = "0.15.7" } dotenvy = { version = "0.15.7" }
const_format = { version = "0.2.34" } const_format = { version = "0.2.36" }
[dev-dependencies] [dev-dependencies]
async-std = { version = "1.13.1" }
+22
View File
@@ -0,0 +1,22 @@
Copyright (c) 2026 Kun Deng.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
+1
View File
@@ -1,3 +1,4 @@
# sienvy
This is a library used to retrieve environment variables associated with various 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 projects. Rather than having the various icarus projects such as icarus,
icarus_auth, songparser, and others, have environment code, it would be more icarus_auth, songparser, and others, have environment code, it would be more
+92 -10
View File
@@ -1,24 +1,106 @@
pub async fn get_db_url() -> String { pub fn get_db_url() -> crate::EnvVar {
dotenvy::dotenv().ok(); 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 fn get_secret_main_key() -> crate::EnvVar {
dotenvy::dotenv().ok(); 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_secret_key() -> String { pub fn get_service_passphrase() -> crate::EnvVar {
dotenvy::dotenv().ok(); dotenvy::dotenv().ok();
std::env::var(crate::keys::SECRET_KEY).expect(crate::keys::error::SECRET_KEY) let key = crate::keys::SERVICE_PASSPHRASE;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
} }
pub async fn get_root_directory() -> String { pub fn get_secret_key() -> crate::EnvVar {
dotenvy::dotenv().ok(); dotenvy::dotenv().ok();
std::env::var(crate::keys::ROOT_DIRECTORY).expect(crate::keys::error::ROOT_DIRECTORY) let key = crate::keys::SECRET_KEY;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
} }
pub async fn get_icarus_base_api_url() -> String { pub fn get_root_directory() -> crate::EnvVar {
dotenvy::dotenv().ok(); dotenvy::dotenv().ok();
std::env::var(crate::keys::ICARUS_BASE_API_URL).expect(crate::keys::error::ICARUS_BASE_API_URL) let key = crate::keys::ROOT_DIRECTORY;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub fn get_soaricarus_base_api_url() -> crate::EnvVar {
dotenvy::dotenv().ok();
let key = crate::keys::SOARICARUS_BASE_API_URL;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub fn get_soaricarus_auth_base_api_url() -> crate::EnvVar {
dotenvy::dotenv().ok();
let key = crate::keys::SOARICARUS_AUTH_BASE_API_URL;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub fn get_app_env() -> crate::EnvVar {
dotenvy::dotenv().ok();
let key = crate::keys::APP_ENV;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub fn get_backend_port() -> crate::EnvVar {
dotenvy::dotenv().ok();
let key = crate::keys::BACKEND_PORT;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub fn get_frontend_url() -> crate::EnvVar {
dotenvy::dotenv().ok();
let key = crate::keys::FRONTEND_URL;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub fn get_rust_log() -> crate::EnvVar {
dotenvy::dotenv().ok();
let key = crate::keys::RUST_LOG;
let value = std::env::var(key).expect(key);
crate::init_envvar(key, &value)
}
pub fn get_allowed_origins() -> crate::EnvVar {
dotenvy::dotenv().ok();
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 fn get_env(environment: &str) -> crate::EnvVar {
dotenvy::dotenv().ok();
let my_error = format!("{environment} {}", crate::keys::error::GENERAL_ERROR);
let value = std::env::var(environment).expect(&my_error);
crate::init_envvar(environment, &value)
} }
+36 -10
View File
@@ -1,27 +1,53 @@
// Environment key for Database management /// Environment key for Database management
pub const DB_URL: &str = "DATABASE_URL"; pub const DB_URL: &str = "DATABASE_URL";
// Environment key for secret main key /// 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"; pub const SECRET_MAIN_KEY: &str = "SECRET_MAIN_KEY";
// Environment key for secret key /// Environment key for service logins
// Generic use of secret key that could be found in various apps pub const SERVICE_PASSPHRASE: &str = "SERVICE_PASSPHRASE";
/// Environment key for secret key
/// Generic use of secret key that could be found in various apps
pub const SECRET_KEY: &str = "SECRET_KEY"; 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"; pub const ROOT_DIRECTORY: &str = "ROOT_DIRECTORY";
// Environment key for icarus api url /// Environment key for soaricarus api url
pub const ICARUS_BASE_API_URL: &str = "ICARUS_BASE_API_URL"; pub const SOARICARUS_BASE_API_URL: &str = "SOARICARUS_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";
/// Environment key for backend port. Used for both auth and core functionality
pub const BACKEND_PORT: &str = "BACKEND_PORT";
/// Environment key for frontend url
pub const FRONTEND_URL: &str = "FRONTEND_URL";
/// Environment key for application logging
pub const RUST_LOG: &str = "RUST_LOG";
/// Environment key for allowed origins for CORS support
pub const ALLOWED_ORIGINS: &str = "ALLOWED_ORIGINS";
pub mod error { pub mod error {
use const_format::concatcp; use const_format::concatcp;
pub const GENERAL_ERROR: &str = "must not be set in enviornment file"; pub const GENERAL_ERROR: &str = "must not be set in enviornment file";
pub const DB_URL: &str = concatcp!(super::DB_URL, " ", GENERAL_ERROR); pub const DB_URL: &str = concatcp!(super::DB_URL, " ", GENERAL_ERROR);
pub const SECRET_KEY: &str = concatcp!(super::SECRET_KEY, " ", GENERAL_ERROR);
pub const SECRET_MAIN_KEY: &str = concatcp!(super::SECRET_MAIN_KEY, " ", GENERAL_ERROR); pub const SECRET_MAIN_KEY: &str = concatcp!(super::SECRET_MAIN_KEY, " ", GENERAL_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 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 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);
pub const RUST_LOG: &str = concatcp!(super::RUST_LOG, " ", GENERAL_ERROR);
pub const ALLOWED_ORIGINS: &str = concatcp!(super::ALLOWED_ORIGINS, " ", GENERAL_ERROR);
} }
+37
View File
@@ -1,2 +1,39 @@
pub mod environment; pub mod environment;
pub mod keys; 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
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",
))
}
}
+124 -13
View File
@@ -2,9 +2,9 @@
mod tests { mod tests {
#[test] #[test]
fn test_dburl() { fn test_dburl() {
let result = async_std::task::block_on(icarus_envy::environment::get_db_url()); let result = sienvy::environment::get_db_url();
assert_eq!( assert_eq!(
result, "postgres://myuser:password@localhost:5432/my_db", result.value, "postgres://myuser:password@localhost:5432/my_db",
"DATABASE_URL does not match {:?}", "DATABASE_URL does not match {:?}",
result result
); );
@@ -12,19 +12,29 @@ mod tests {
#[test] #[test]
fn test_get_secret_main_key() { fn test_get_secret_main_key() {
let result = async_std::task::block_on(icarus_envy::environment::get_secret_main_key()); let result = sienvy::environment::get_secret_main_key();
assert_eq!( assert_eq!(
result, "Somesupersecretpassword!!!45345435", result.value, "Somesupersecretpassword!!!45345435",
"SECRET_MAIN_KEY does not match {:?}", "SECRET_MAIN_KEY does not match {:?}",
result result
) )
} }
#[test] #[test]
fn test_get_secret_key() { fn test_get_service_passphrase() {
let result = async_std::task::block_on(icarus_envy::environment::get_secret_key()); let result = sienvy::environment::get_service_passphrase();
assert_eq!( assert_eq!(
result, "AmIGoodEnoughForYou?", result.value, "T5OCHDHadAtuOWIqRAS7u8XHDDkzKT1Uvvw7mGMkNzKjVdlHA8xGdILf2adDHspO",
"SERVICE_PASSPHRASE does not match {:?}",
result
)
}
#[test]
fn test_get_secret_key() {
let result = sienvy::environment::get_secret_key();
assert_eq!(
result.value, "AmIGoodEnoughForYou?",
"SECRET_KEY does not match {:?}", "SECRET_KEY does not match {:?}",
result result
) )
@@ -32,21 +42,122 @@ mod tests {
#[test] #[test]
fn test_get_root_directory() { fn test_get_root_directory() {
let result = async_std::task::block_on(icarus_envy::environment::get_root_directory()); let result = sienvy::environment::get_root_directory();
assert_eq!( assert_eq!(
result, "/path/to/root", result.value, "/path/to/root",
"ROOT_DIRECTORY does not match {:?}", "ROOT_DIRECTORY does not match {:?}",
result result
) )
} }
#[test] #[test]
fn test_get_icarus_base_api_url() { fn test_get_soaricarus_base_api_url() {
let result = async_std::task::block_on(icarus_envy::environment::get_icarus_base_api_url()); let result = sienvy::environment::get_soaricarus_base_api_url();
assert_eq!( assert_eq!(
result, "https://icarus.com", result.value, "https://soaricarus.com",
"ICARUS_BASE_API_URL does not match {:?}", "SOARICARUS_BASE_API_URL does not match {:?}",
result result
) )
} }
#[test]
fn test_get_app_env() {
let result = sienvy::environment::get_app_env();
assert_eq!(
result.value,
"development",
"{} does not match {:?}",
sienvy::keys::APP_ENV,
result
)
}
#[test]
fn test_get_backend_port() {
let result = sienvy::environment::get_backend_port();
assert_eq!(
result.value,
"8001",
"{} does not match {:?}",
sienvy::keys::BACKEND_PORT,
result
)
}
#[test]
fn test_get_frontend_url() {
let result = sienvy::environment::get_frontend_url();
assert_eq!(
result.value,
"http://localhost:4200",
"{} does not match {:?}",
sienvy::keys::FRONTEND_URL,
result
)
}
#[test]
fn test_get_rust_log() {
let result = sienvy::environment::get_rust_log();
assert_eq!(
result.value,
"debug",
"{} does not match {:?}",
sienvy::keys::RUST_LOG,
result
)
}
#[test]
fn test_get_allowed_origins() {
let result = sienvy::environment::get_allowed_origins();
assert_eq!(
result.value,
"https://soaricarus.com,https://www.soaricarus.com",
"{} does not match {:?}",
sienvy::keys::ALLOWED_ORIGINS,
result
);
assert_eq!(
result.has_delimiter, true,
"The {} variable has an issue finding the delimiter",
result.key
);
match sienvy::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 = sienvy::environment::get_env(key);
assert_eq!(
result.value, *value,
"{:?} does not match {:?}",
key, result
)
}
}
} }