Github commit / push规则,检查两个文件具有相同的变量列表

Suh*_*iya 0 git github ballerina

我的Github存储库中有两个用芭蕾舞女演员语言编写的文件。
ballerina.confballerina.conf.example用于存储类似配置变量的列表。

在这些文件中,我将ACTUAL用户凭据(用于连接到多个系统)保留在ballerina.conf文件中。
但是当将项目提交到GitHub时,我只想提交ballerina.conf.example文件。我可以省略ballerina.conf文件中的.gitignore文件。

我的问题是,用户有时可能会忘记在ballerina.confballerina.conf.example文件中都包含相同的变量。

ballerina.conf -> DB_USERNAME = 'cseuser'  
ballerina.conf.example -> DB_USERNAME = '[dbusername]'  
Run Code Online (Sandbox Code Playgroud)

有没有一种方法可以在Github中强制执行规则,以便在提交/推送时两个文件中都引入了新引入的变量,从而比较这两个文件?

例如,如果用户仅在ballerina.conf文件中引入了变量,我想拒绝向用户说出原因的提交/推送。即也将相同的变量添加到ballerina.conf.example虚拟值中。

Suh*_*iya 6

刚刚发现,芭蕾舞女演员语言本身提供了一种使用command对密码进行加密的方法ballerina encrypt

例如,加密值:1234

以下是我尝试过的示例输出。

$ballerina encrypt 
Enter value:

Enter secret: 

Re-enter secret to verify:

Add the following to the runtime config:
@encrypted:{DMTaGYeDc2B9SBJmy5ekUSsYW8TV1uipLPTofy4zjr2Ke8eZ7khQbyDnKnNJ1kZm}

Or add to the runtime command line:
-e<param>=@encrypted:{DMTaGYeDc2B9SBJmy5ekUSsYW8TV1uipLPTofy4zjr2Ke8eZ7khQbyDnKnNJ1kZm}
Run Code Online (Sandbox Code Playgroud)

我在以下方式中使用了加密值ballerina.conf

DB_USERNAME = "@encrypted:{l1WoT/u1YMX2+njesLjzKdpHXT7Vk03d830mjCFTSB+75aeohAO2AkEScotn7Wry}"
Run Code Online (Sandbox Code Playgroud)

因此,无需在Github中维护辅助文件。

更新资料

运行芭蕾舞女演员服务时,芭蕾舞女演员会要求输入您用来对ballerina.conf文件中的密码进行加密的机密。

$ballerina run integrator/
ballerina: enter secret for config value decryption: 
<type your encryption password here (not visible), 1234>

ballerina: started HTTP/WS endpoint 0.0.0.0:3001


2019-03-03 12:44:25,999 INFO  [integrator:0.0.0] - service started  
Run Code Online (Sandbox Code Playgroud)