1.0.7 • Published 2 years ago

@codrjs/config v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@codrjs/config

npm version CodeQL

Purpose

This repository is a custom-built configuration manager for all repositories. This module manages everything configuration and should be used in all projects manages so that environment variables are unified, making transitioning development from one domain to another easy.

Getting started

Install the package from the npm registry.

yarn add @codrjs/config

Import the config package and use the variables you need!

*Please note: This package assumes you have defined the environment variables you are accessing and does no error checking.*

/* Import the config package */
import config, { ExpressConfig } from "@codrjs/config";
import { express } from "express";

const app = express();

app.listen(config.express.port, config.express.host, () => {
  console.log(
    `Server is starting on ${ExpressConfig.host}:${ExpressConfig.port}`,
  );
});

Environemnt Variable Names

Location of environment variable is postfixed to Config.{location} (e.g. Config.express.host).

Env varLocationDescription
ENVenvDeployment envionment - dev, qa, stage, prod
HOSTNAMEhostnameDeployment docker hostname
Provided via npmnameDeployment service name - example: codr-user-user
Provided via npmversionDeployment version - example: 1.0.0
AWS_REGIONaws.regionAWS - deployment region
AWS_SES_API_VERSIONaws.ses.api.versionAWS SES - api version
AWS_SES_ACCESS_KEYaws.ses.access.keyAWS SES - IAM access key id
AWS_SES_ACCESS_SECRETaws.ses.access.secretAWS SES - IAM access key secret
CODR_USER_AUTH_SVC_URLcodr.svc.user.authCodr - user authentication service
CODR_USER_PROFILE_SVC_URLcodr.svc.user.profileCodr - user profile entity service
CODR_USER_SESSION_SVC_URLcodr.svc.user.sessionCodr - user session entity service
CODR_USER_USER_SVC_URLcodr.svc.user.userCodr - user entity service
EMAIL_FROMemail.fromEmail - from address
EMAIL_REPLY_TOemail.replytoEmail - reply to address(es)
EXPRESS_HOSTexpress.hostExpress server - listener host
EXPRESS_PORTexpress.portExpress server - listener port
GIT_BRANCHgit.brachGit - branch
GIT_COMMITgit.commitGit - commit sha
GIT_REPOgit.repoGit - repository
JWT_ALGORITHMjwt.algorithmJWT - algorithm, default HS256
JWT_SECRETjwt.secretJWT - secret, key to decode jwt, must be the same across all services in an environment
JWT_ISSUERjwt.issuerJWT - issuer, default codrjs.com
KAFKA_BROKERSkafka.brokersKafka server - comma seperated locations of the kafka brokers
KAFKA_CLIENT_IDkafka.clientIdKafka server - name of the kafka cluster
KAFKA_CONSUMER_GROUPkafka.consumer.groupKafka server - consumer group
MONGO_URImongo.uriMongoDB - server URL, please include username and password to this string
NODE_ENVnode.envNode environment - development, production, testing
Provided via npmnode.verisonNode version - example: 16.19.1
Provided via npmnode.modulesNode modules - string array of all dependencies
Provided via yarnnode.yarnVersionNode - package manager version
OPENAPI_INFO_TITLEopenapi.info.titleOpenAPI - documentation title
OPENAPI_INFO_DESCopenapi.info.descriptionOpenAPI - documentation description
OPENAPI_SERVER_ONE_URLopenapi.server[0].urlOpenAPI - server one url
OPENAPI_SERVER_ONE_DESCopenapi.server[0].descriptionOpenAPI - server one description
OPENAPI_SERVER_TWO_URLopenapi.server[1].urlOpenAPI - server two url
OPENAPI_SERVER_TWO_DESCopenapi.server[1].descriptionOpenAPI - server two description
OPENAPI_SERVER_THREE_URLopenapi.server[2].urlOpenAPI - server three url
OPENAPI_SERVER_THREE_DESCopenapi.server[2].descriptionOpenAPI - server three description
OPENAPI_SERVER_FOUR_URLopenapi.server[3].urlOpenAPI - server four url
OPENAPI_SERVER_FOUR_DESCopenapi.server[3].descriptionOpenAPI - server four description
OPENAPI_SERVER_FIVE_URLopenapi.server[4].urlOpenAPI - server five url
OPENAPI_SERVER_FIVE_DESCopenapi.server[4].descriptionOpenAPI - server five description

TODO

  • ...

Contributing

# Clone the repo
git clone git@github.com:CodrJS/config.git

# Install yarn if you don't have it already
npm install -g yarn

# Install dependencies, build, and test the code
yarn install
yarn build
yarn test
1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3-patch2

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago