mineadmin / components

mine-admin library
Apache License 2.0
10 stars 21 forks source link

add config encrypt #36

Closed netyum closed 8 months ago

netyum commented 8 months ago

开启配置文件加密 config/autoload/mineadmin.php

   // 是否开启加密
    'config_encryption' => false,
    'config_encryption_key' => 'oqye5o39exzj47LDFMT2oxRJUmy18Fwo0LB006Uo6fk=',
    'config_encryption_iv' => 'bQEvWfcM6xlt3ZtYgBoK/A==',

生成key和向量

$ swoole-cli bin/hyperf.php mine:config-crypt-gen
config encrypt key generator successfully:Y9ozU3eAzlCGVQgV6rr1tEZ/pHORcXO+Y3yIBOsrnGw=
config encrypt iv generator successfully:elvcz9OWCUQwhg/glhBSbA==

替换配置里的key 和iv

加密内容

$ swoole-cli bin/hyperf.php mine:config-crypt 127.0.0.1
config crypt string is: ENC(1d960HOueiIZycVRhSKcFA==)

替换.env DB_HOST = "ENC(7qxSDf406CtEeNVo6D5q/w==)"