Skip to content

Commit

Permalink
moving paths around
Browse files Browse the repository at this point in the history
  • Loading branch information
shannonhochkins committed Jul 5, 2024
1 parent db7d8dc commit 03d61e7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ packages/core/.env
hakit/config
hakit/server/hakit-designer
hakit/server/options.json
hakit/service-account.json
trace
trace/*
2 changes: 1 addition & 1 deletion hakit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Running the dashboard interface for the addon is as simple as running:
"custom_dashboard": false // switching to true will attempt to load a html file under hakit/config/www/ha-dashboard/index.html so you will need to create the `config` folder as well as all subdirectories if you're testing this flow.
}
```
2. create a `service-account.json` file with credentials pointing to the google drive account in the `hakit` directory.
2. create a `service-account.json` file with credentials pointing to the google drive account in the `hakit/config/hakit-designer` directory.
3. `npm i && npm run dev`

This will spin up a server under `http://localhost:2022`
Expand Down
2 changes: 1 addition & 1 deletion hakit/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Hakit",
"version": "1.0.25",
"version": "1.0.26",
"slug": "hakit",
"init": false,
"ingress": true,
Expand Down
3 changes: 2 additions & 1 deletion hakit/server/google/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { existsSync } from 'fs';
import { GoogleAuth, GoogleAuthOptions } from 'google-auth-library';
import { join } from 'path';
import { APP_DIRECTORY } from '../../constants.js';

const SERVICE_ACCOUNT_FILE = join(process.cwd(), 'service-account.json');
const SERVICE_ACCOUNT_FILE = join(APP_DIRECTORY, 'service-account.json');

export const SCOPES = [
'https://www.googleapis.com/auth/drive.readonly',
Expand Down
3 changes: 2 additions & 1 deletion hakit/server/routes/write-file.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Request, Response } from 'express';
import { join } from 'path';
import { writeFile as fsWriteFile } from 'fs/promises';
import { APP_DIRECTORY } from 'server/constants.js';

export async function writeFile(req: Request, res: Response) {
try {
Expand All @@ -10,7 +11,7 @@ export async function writeFile(req: Request, res: Response) {
return res.status(400).send('Filename and content are required.');
}

const filePath = join(process.cwd(), filename);
const filePath = join(APP_DIRECTORY, filename);
const fileContents = typeof content === 'string' ? content : JSON.stringify(content, null, 2);

await fsWriteFile(filePath, fileContents, 'utf8');
Expand Down

0 comments on commit 03d61e7

Please sign in to comment.