Add Docker support and enhance configuration management
- Introduced Dockerfile for building and running the application in a containerized environment. - Added .dockerignore to exclude unnecessary files from the Docker context. - Updated README.md with detailed Docker installation instructions and Node.js version management using nvm. - Refactored environment variable handling in src/index.ts and src/config/hass.config.ts for improved configuration management. - Enhanced TypeScript configuration to include JSON module resolution and updated exclusion patterns. - Updated .gitignore to include additional files for better environment management.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { CreateApplication, TServiceParams, StringConfig } from "@digital-alchemy/core";
|
||||
import { LIB_HASS, PICK_ENTITY } from "@digital-alchemy/hass";
|
||||
import { DomainSchema } from "../schemas.js";
|
||||
import { HASS_CONFIG } from "../config/hass.config.js";
|
||||
|
||||
type Environments = "development" | "production" | "test";
|
||||
|
||||
@@ -25,19 +26,39 @@ const MY_APP = CreateApplication({
|
||||
enum: ["development", "production", "test"],
|
||||
description: "Code runner addon can set with it's own NODE_ENV",
|
||||
} satisfies StringConfig<Environments>,
|
||||
HASS_HOST: {
|
||||
type: "string",
|
||||
description: "Home Assistant host URL",
|
||||
required: true
|
||||
},
|
||||
HASS_TOKEN: {
|
||||
type: "string",
|
||||
description: "Home Assistant long-lived access token",
|
||||
required: true
|
||||
}
|
||||
},
|
||||
services: {},
|
||||
libraries: [LIB_HASS],
|
||||
libraries: [
|
||||
{
|
||||
...LIB_HASS,
|
||||
configuration: {
|
||||
BASE_URL: {
|
||||
type: "string",
|
||||
description: "Home Assistant base URL",
|
||||
required: true,
|
||||
default: HASS_CONFIG.BASE_URL
|
||||
},
|
||||
TOKEN: {
|
||||
type: "string",
|
||||
description: "Home Assistant long-lived access token",
|
||||
required: true,
|
||||
default: HASS_CONFIG.TOKEN
|
||||
},
|
||||
SOCKET_URL: {
|
||||
type: "string",
|
||||
description: "Home Assistant WebSocket URL",
|
||||
required: true,
|
||||
default: HASS_CONFIG.SOCKET_URL
|
||||
},
|
||||
SOCKET_TOKEN: {
|
||||
type: "string",
|
||||
description: "Home Assistant WebSocket token",
|
||||
required: true,
|
||||
default: HASS_CONFIG.SOCKET_TOKEN
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
name: 'hass' as const
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user