
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@kibibit/configit
Advanced tools
A general typescript configuration service
Unless forced to create a new service, this service will return the first created service
Create a new class to define your configuration.
The class should extend the Config
class from this repo
import { IsNumber, IsString } from 'class-validator';
import { BaseConfig, Configuration, ConfigVariable } from '@kibibit/configit';
@Configuration()
export class ProjectConfig extends BaseConfig {
@ConfigVariable('Server port')
@IsNumber()
PORT: number;
@ConfigVariable([
'This is the slack API to talk and report to channel "hello"'
])
@IsString()
SLACK_API_KEY: string;
}
}
Then, in your code, initialize the config service when you bootstrap your application
import express from 'express';
import { ConfigService } from '@kibibit/configit';
import { ProjectConfig } from './project-config.model';
export const configService = new ConfigService<ProjectConfig>(ProjectConfig);
const app = express();
app.get( '/', ( req, res ) => {
res.send( 'Hello world!' );
} );
app.listen(configService.config.PORT, () => {
console.log(
`server started at http://localhost:${ configService.config.PORT }`
);
});
You can extend the configuration to add your own customization and functions!
import { chain } from 'lodash';
import { ConfigService, IConfigServiceOptions } from '@kibibit/configit';
import { WinstonLogger } from '@kibibit/nestjs-winston';
import { ExtProjectConfig } from './ext-project-config.model';
import { initializeWinston } from './winston.config';
export class ExtConfigService extends ConfigService<ExtProjectConfig> {
public logger: WinstonLogger;
constructor(passedConfig?: Partial<ExtProjectConfig>, options: IConfigServiceOptions = {}) {
super(ExtProjectConfig, passedConfig, options);
initializeWinston(this.appRoot);
this.logger = new WinstonLogger('');
}
getSlackApiObject() {
const slackApiObject = chain(this.toPlainObject())
.pickBy((value, key) => key.startsWith('SLACK_'))
.mapKeys((value, key) => key.replace(/^SLACK_/i, ''))
.mapKeys((value, key) => key.toLowerCase())
.value();
return slackApiObject;
}
}
export const configService = new ExtConfigService() as ExtConfigService;
yaml-config
in the examples folder--saveToFile
or --init
See the examples folder for a variety of usage examples
Thanks goes to these wonderful people (emoji key):
Neil Kalman 💻 📖 🎨 🚧 🚇 ⚠️ | Nitzan Madar 💻 | Dafna Assaf 💻 |
This project follows the all-contributors specification. Contributions of any kind are welcome!
FAQs
a general typescript configuration service
We found that @kibibit/configit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.