diff --git a/README.md b/README.md index f273755..ad91bd9 100644 --- a/README.md +++ b/README.md @@ -37,15 +37,17 @@ app.listen(config.express.port, config.express.host, () => { Location of environment variable is postfixed to `Config.{location}` (e.g. `Config.express.host`). -| Env var | Location | Required | Description | -| ---------------------- | ---------------------- | -------- | --------------------------------------------------------------------------------------- | -| `ENV` | `env` | `true` | Deployment envionment - `dev`, `qa`, `stage`, `prod` | -| `EXPRESS_HOST` | `express.host` | `false` | Express server - listener host | -| `EXPRESS_PORT` | `express.port` | `false` | Express server - listener port | -| `MONGO_URI` | `mongo.uri` | `false` | MongoDB - server URL, please include username and password to this string. | -| `KAFKA_CONSUMER_GROUP` | `kafka.consumer.group` | `false` | Kafka server - consumer group | -| `JWT_SECRET` | `jwt.secret` | `true` | JWT - secret, key to decode jwt, must be the same across all services in an environment | -| `JWT_ISSUER` | `jwt.issuer` | `true` | JWT - issuer, default `codrjs.com` | +| Env var | Location | Description | +| ---------------------- | ---------------------- | --------------------------------------------------------------------------------------- | +| `ENV` | `env` | Deployment envionment - `dev`, `qa`, `stage`, `prod` | +| `EXPRESS_HOST` | `express.host` | Express server - listener host | +| `EXPRESS_PORT` | `express.port` | Express server - listener port | +| `MONGO_URI` | `mongo.uri` | MongoDB - server URL, please include username and password to this string | +| `KAFKA_BROKERS` | `kafka.brokers` | Kafka server - comma seperated locations of the kafka brokers | +| `KAFKA_CLIENT_ID` | `kafka.clientId` | Kafka server - name of the kafka cluster | +| `KAFKA_CONSUMER_GROUP` | `kafka.consumer.group` | Kafka server - consumer group | +| `JWT_SECRET` | `jwt.secret` | JWT - secret, key to decode jwt, must be the same across all services in an environment | +| `JWT_ISSUER` | `jwt.issuer` | JWT - issuer, default `codrjs.com` | ## TODO diff --git a/package.json b/package.json index 83e20bc..450d644 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codrjs/config", - "version": "1.0.0", + "version": "1.0.1", "description": "Codr configuration, unified", "main": "./cjs/index.js", "module": "./esm/index.js", diff --git a/src/config/KafkaConfig.ts b/src/config/KafkaConfig.ts index b52bc64..58ad367 100644 --- a/src/config/KafkaConfig.ts +++ b/src/config/KafkaConfig.ts @@ -1,5 +1,9 @@ export const KafkaConfig: { + brokers: string; + clientId: string; consumer: { group: string }; } = { + brokers: process.env.KAFKA_BROKERS as string, + clientId: process.env.KAFKA_CLIENT_ID as string, consumer: { group: process.env.KAFKA_CONSUMER_GROUP as string }, }; diff --git a/src/config/index.ts b/src/config/index.ts index cc1298c..ca2d521 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -6,7 +6,7 @@ import { JWTConfig } from "./JWTConfig"; import { KafkaConfig } from "./KafkaConfig"; import { MonogoConfig } from "./MongoConfig"; -const config = { +const Config = { env: process.env.ENV as "dev" | "qa" | "stage" | "prod", express: ExpressConfig, jwt: JWTConfig, @@ -15,4 +15,4 @@ const config = { }; export { ExpressConfig, JWTConfig, KafkaConfig, MonogoConfig }; -export default config; +export default Config; diff --git a/src/index.ts b/src/index.ts index b576b6d..7256f2c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import config from "./config"; +import Config from "./config"; export * from "./config"; -export default config \ No newline at end of file +export default Config \ No newline at end of file