Skip to content

Commit

Permalink
Add DB_PASSWORD to environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
codad5 committed Nov 28, 2023
1 parent aee03a2 commit 41ecd3d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VITE_GOOGLE_CLIENT_ID=YOUR_CLIENT_ID
VITE_GOOGLE_CLIENT_SECRET=YOUR_CLIENT_SECRET
PASSWORD=YOUR_PASSWORD
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
with:
# tauri-action replaces \_\_VERSION\_\_ with the app version
tagName: ${{ github.ref_name }}
Expand Down
4 changes: 2 additions & 2 deletions src-tauri/src/libs/access_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct AccessToken {
impl AccessToken {
pub fn save(&self) -> SaveAccessTokenResponse {
let encoded = to_vec(self).unwrap();
let password: String = env::var("PASSWORD").unwrap();
let password: String = env::var("DB_PASSWORD").unwrap();
let mut cocoon = Cocoon::new(password.as_bytes());
println!("About to open db file");
let mut file = std::fs::OpenOptions::new()
Expand All @@ -45,7 +45,7 @@ impl AccessToken {

pub fn load() -> AccessToken {
let mut file = std::fs::File::open(&*ACCESS_TOKEN_FILE).unwrap();
let binding = env::var("PASSWORD").unwrap();
let binding = env::var("DB_PASSWORD").unwrap();
let cacoon = Cocoon::new(binding.as_bytes());
let encoded = cacoon.parse(&mut file).unwrap();
return AccessToken::try_from_slice(&encoded).unwrap();
Expand Down

0 comments on commit 41ecd3d

Please sign in to comment.