Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
= Configlet
== Description
A stupid simple wrapper for environment variables.
This doesn't deserve to be released as a gem, but I'm using it in two different projects. Seriously, go find a real configuration library and use it instead.
== Examples
require "configlet"
# assuming...
ENV["THUNK_STATUS"] = "crazy-awesome"
ENV["THUNK_FINISHED"] = "false"
# some bits of optional config
Configlet.prefix = :thunk
Configlet.default :token => "default-token"
Configlet.munge(:finished) { |k| "true" == k }
# grabbin' values
Configlet[:status] # => "crazy-awesome"
Configlet[:finished] # => false
Configlet[:token] # => "default-token"
There's also a block form, which is nice if you're setting a lot of defaults:
Configlet.config :thunk do
default :token => "default-token"
default :host => "thunk.local"
end
Defaults can be lazy, too: Just use a lambda. The default will be resolved the first time its value is grabbed.
default :db => lambda { "db://whatever/#{Rails.env}" } # or...
default(:db) { "db://whatever/#{Rails.env}" }
Configlet is a module, so +include+ or +extend+ it wherever you want. It extends itself for your convenience.
== Transformation
Want something other than a string? You can munge any value:
default :url => "http://example.org"
munge(:url) { |v| URI.parse v }
Configlet[:url] # => #<URI::HTTP:0xdeadbeef URL:http://example.org>
In fact, there's a shortcut just for URLs. I haven't added any others 'cause I haven't needed to care:
url :url => "http://example.org"
Configlet[:url] # => #<URI::HTTP:0xcafebabe URL:http://example.org>
== Installation
$ gem install configlet
== License
Copyright 2010 John Barnette (code@jbarnette.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Unknown package
We found that configlet 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
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.