
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
tbs-site-config
Advanced tools
Package for handling site config distribution between repository. Which site config data saved on server memory as variable, so data can be consumed much faster than HTTP request.
Package for handling site config distribution between repository. Which site config data saved on server memory as variable, so data can be consumed much faster than HTTP request.
yarn add tbs-site-config
npm install tbs-site-config
For initializing package you need to write in 2 file
import { TbsSiteConfigModule } from 'tbs-site-config';
@Module({
imports: [
TbsSiteConfigModule.registerAsync({
options: {
name: "redis", // this line will be overrided on library, so you can write as you want caused it wont be used
transport: Transport.REDIS,
options: { port: +process.env.REDIS_PORT, host: process.env.REDIS_HOST },
},
isMaster: true,
mongoDbUrl: process.env.MONGO_URL,
mongoDbName: "tbs_db_utils",
mongoDbCollection: SiteConfig.name.toLowerCase() + "s",
})
],
controllers: [],
providers: [],
})
export class ExampleModule {}
The initialization code above is intended for the master repository, which means that the repository is the one that owns and manipulates the site config data. isMaster being filled with true indicates that this is the master repository
import { TbsSiteConfigModule } from 'tbs-site-config';
@Module({
imports: [
TbsSiteConfigModule.registerAsync({
configUrl: process.env.UTIL_SERVICE_URL + "/api/v1/configs",
options: {
name: "redis", // this line will be overrided on library, so you can write as you want caused it wont be used
transport: Transport.REDIS,
options: { port: +process.env.REDIS_PORT, host: process.env.REDIS_HOST },
},
})
],
controllers: [],
providers: [],
})
export class ExampleModule {}
On client repository only need the config url for fetching initial data from that endpoint.
import {TbsSiteConfigServer} from 'tbs-site-config'
TbsSiteConfigServer(app, {
transport: Transport.REDIS,
options: { port: +process.env.REDIS_PORT, host: process.env.REDIS_HOST },
});
await app.startAllMicroservices();
Master and client repository must initialize above code for start the microservice server. Which microservice server will be used for listening any changes on master repository
import { SITE_CONFIGS } from 'tbs-site-config';
@Injectable()
export class SiteConfigService {
constructor(
@Inject(SITE_CONFIGS) private readonly siteConfig: Record<string, any>,
) {
}
async findAll() {
return this.siteConfig;
}
async findOne(key: string) {
return this.siteConfig[key]
}
}
note: While injecting site config the data type is must be Record<string,any>
also for accessing single data you must pass the key
import { TbsSiteConfigService, SITE_CONFIGS } from 'tbs-site-config';
@Controller()
export class SiteConfigController {
constructor(
private readonly siteConfigService: TbsSiteConfigService,
@Inject(SITE_CONFIGS) private readonly siteConfig: Record<string, any>
) {
}
async updateOne(key: string, data: Record<string, any>) {
return this.siteConfigService.update(data);
}
async updateSpecificField(key: string, value: string, status: number) {
return this.siteConfigService.update({ ...this.siteConfig[key], value, status });
}
}
note: To modify the current data, it only supports modifying all the data, and cannot only modify some or certain fields
FAQs
Package for handling site config distribution between repository. Which site config data saved on server memory as variable, so data can be consumed much faster than HTTP request.
The npm package tbs-site-config receives a total of 49 weekly downloads. As such, tbs-site-config popularity was classified as not popular.
We found that tbs-site-config demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.