Skip to content

Commit

Permalink
Merge pull request #4 from jdeniau/remove-dotenv
Browse files Browse the repository at this point in the history
remove dotenv
  • Loading branch information
jdeniau authored Feb 20, 2024
2 parents 124d5e0 + 2163f12 commit e8dead4
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 27 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"dependencies": {
"bootstrap": "^5.3.2",
"classnames": "^2.5.1",
"dotenv": "^16.4.4",
"electron-squirrel-startup": "^1.0.0",
"electron-store": "^8.1.0",
"env-paths": "^3.0.0",
Expand Down
10 changes: 4 additions & 6 deletions src/component/Connection/ConnectionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ class ConnectionForm extends PureComponent<
this.state = {
name: '',
save: true,
host: window.env.TIANA__DEBUG_DB_HOST || 'localhost',
port: window.env.TIANA__DEBUG_DB_PORT
? parseInt(window.env.TIANA__DEBUG_DB_PORT, 10)
: 3306,
user: window.env.TIANA__DEBUG_DB_USER || '',
password: window.env.TIANA__DEBUG_DB_PASSWORD || '',
host: 'localhost',
port: 3306,
user: '',
password: '',
};

this.handleInputChange = this.handleInputChange.bind(this);
Expand Down
2 changes: 0 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import installExtension, {
import connectionStackInstance from './sql';
import { readConfigurationFile, addConnectionToConfig } from './configuration';

require('dotenv').config({ path: '../.env' });

// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) {
app.quit();
Expand Down
13 changes: 0 additions & 13 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ import { ConnectionObject } from './component/Connection';
import { Configuration } from './configuration';
import { contextBridge, ipcRenderer } from 'electron';

// === environment variables ===
type TianaString = string; // maybe `TIANA__${string}` is TS 5 ?
type TianaEnvVariables = Record<string, TianaString>;

const fpEnvVariables: TianaEnvVariables = Object.fromEntries(
Object.entries(process.env).filter((entry): entry is [TianaString, string] =>
entry[0].startsWith('TIANA__')
)
);

contextBridge.exposeInMainWorld('env', fpEnvVariables);

// === Configuration ===
interface Config {
readConfigurationFile(): Promise<null | Configuration>;
Expand Down Expand Up @@ -53,7 +41,6 @@ contextBridge.exposeInMainWorld('sql', sql);
// Declare window global that have been added
declare global {
interface Window {
env: TianaEnvVariables;
config: Config;
sql: Sql;
}
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1969,11 +1969,6 @@ dot-prop@^6.0.1:
dependencies:
is-obj "^2.0.0"

dotenv@^16.4.4:
version "16.4.4"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.4.tgz#a26e7bb95ebd36272ebb56edb80b826aecf224c1"
integrity sha512-XvPXc8XAQThSjAbY6cQ/9PcBXmFoWuw1sQ3b8HqUCR6ziGXjkTi//kB9SWa2UwqlgdAIuRqAa/9hVljzPehbYg==

[email protected]:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
Expand Down

0 comments on commit e8dead4

Please sign in to comment.