Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

file_secrets

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file_secrets

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

FileSecrets

This gem provides a simple method to support the pattern of reading sensitive information that is stored in files that is deployed separately from the code that needs them.

The basic pattern is to deploy your sensitive information into a directory structure like:

/srv
|-- /secrets
    |--/api
       |-- secret_key
       |-- token

You could then read your secrets with FileSecrets:

  secrets = FileSecrets.new("/srv/secrets")
  secrets["api/secret_key"]
  secrets["api/token"]

If the file doesn't exist, nil will be returned.

Each FileSecrets object will have a base directory where it will locate the files from. If this is not provided in the initializer, it will be set from the FILE_SECRETS_BASE environment variable. If that isn't set, then it will be set to the current working directory.

There is also a handy class level accessor that you can use either if you want to use the default base path:

  ENV["FILE_SECRETS_BASE"] = "/srv/secrets"
  FileSecrets["api/secret_key"]
  FileSecrets["api/token"]

The paths passed to get the file values are virtual paths using the / character as a file separator. So, you would pass the same keys on Windows that you would on Linux.

FAQs

Package last updated on 03 Mar 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc