Hide Service Passwords in Cake Build

I use Cake assembly to build and deploy the project, but in my script I have some service passwords that I don't want to disclose.

Is it possible to read passwords from an external file (maybe JSON?), Which I would not click on Github? So this file will only be on my computer.

Is there a standard way to do this with Cake?

+4
source share
1 answer

The easiest way is to save this password as an environment variable in the system on which you are building. Then you can use an alias EnvironmentVariableto request this value, and then use it in your script:

http://cakebuild.net/api/Cake.Common/EnvironmentAliases/F508FA2B

/ , Cake. . :

https://github.com/cake-build/cake/blob/develop/build/credentials.cake#L15

:

public static BuildCredentials GetGitHubCredentials(ICakeContext context)
{
    return new BuildCredentials(
        context.EnvironmentVariable("CAKE_GITHUB_USERNAME"),
        context.EnvironmentVariable("CAKE_GITHUB_PASSWORD"));
}

, , script.

. context , , Cake . , Environment .

, - , , , , , .

+8

Source: https://habr.com/ru/post/1672149/


All Articles