Giter Club home page Giter Club logo

laravel-gcp-secret-injector's Introduction

Load secrets into your environmental variable without declaring it in your .env

This package helps load sensitive data from you Google Cloud Secret Manager into your laravel environment instead of explictly defining it in your .env file.

Prerequisite

You need to already have google/cloud-secret-manager installed in your project.

Installation

You can install this package via composer:

composer require agz/laravel-secret-injector

To publish the config file run the vendor publish command:

php artisan vendor:publish --tag=gcp-secret-injector

Configuration

After publishing the secret inject assets, its configuration will be located at config/secret-injector.php. The configuration allows you to configure you environmental variables against the your Google Cloud secrets.

return [

    'project_id' => env('GOOGLE_CLOUD_PROJECT'),
    'includedEnvs' => ['production'],
    'secrets' => []
];

The project_id points to your google cloud project id. The includedEnvs tells configures what environments which you want the library to be active. For example, by default is configured to be just production. Meaning that once your APP_ENV is set to production, then the library will pull secrets from your Google Cloud Secret Manager in to your environment.

The secrets is used to configure what environmental variables should point to which secrets.

'secrets' => [
        'ENVIROMENTAL_VARIABLE' => 'SECRET_NAME:VERSION',
    ]

For example:

'secrets' => [
        'APP_KEY' => 'APP_KEY:latest',
        'DB_PASSWORD' => 'DB_PASSWORD:1',
    ]

Testing

composer test

Contributors

License

The MIT License (MIT). Please see License File for more information.

laravel-gcp-secret-injector's People

Contributors

preciousaang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.