How should secret keys be managed?

Asked 1 years ago, Updated 1 years ago, 68 views

I created a web application using Ravel 8 and Firebase Authentication.
We have installed a json file downloaded from Firebase under resources/keys/ and are using it on the application side with reference to the following site:

Note that Ravel 6.0 was authenticated with Firebase's Twitter Outh authentication

.env

FIREBASE_CREDENTIALS=secret.json

config/firebase.php

<?php

return [
    'credentials' = > [
        'file' = > base_path(env('FIREBASE_CREDENTIALS')),
        'auto_discovery' = > true,
    ],
];

I don't know how to manage json for Firebase certification in Docker development and production environment.
I'm using github, but I think it's better to commit and push here, and if I push it, the actual production and Docker authentication json will be the same.

Is there a way to separate and manage authentication json for each environment?
I would appreciate it if you could let me know.

Thank you for your cooperation.

firebase security

2022-09-30 19:51

1 Answers

We recommend that you use the .gitignore file to register files that should not be pushed to GitHub, including credentials.

Ignore Files - GitHub Docs

Also, there seems to be a way to switch settings and manage them by environment, such as .env.production or .env.development.

(This is an example from Ruby, so I don't know if it's true, but I think I can apply the basic concept as dotenv.)

What other.env*files can I use?|Ruby dotenv

The following may be a little old, but here are some examples of explanations in Japanese on Ravel.

[Larvel 5.5]Toggle .env files by environment


2022-09-30 19:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.