package com.bonus.sgzb.gateway;

import org.jasypt.encryption.StringEncryptor;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

import javax.annotation.Resource;

/**
 * 网关启动程序
 * 
 * @author ruoyi
 */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
public class SgzbGatewayApplication implements CommandLineRunner {
    public static void main(String[] args)
    {
        SpringApplication.run(SgzbGatewayApplication.class, args);
        System.out.println("(♥◠‿◠)ﾉﾞ  网关启动成功   ლ(´ڡ`ლ)ﾞ  \n");
    }

    @Resource
    private StringEncryptor encryptor;
    @Override
    public void run(String... args) throws Exception {
//        String nacos = encrypt("Jjsp@nacos2023" );
//        String mysqlNm = encrypt("prod_rental" );
//        String mysqlPs = encrypt("bx%RlBIJOyDzHShQpeWI" );
//        String redis = encrypt("Dszbns@Redis123!" );
//        System.err.println( "nacos原始明文密码加密后的结果为：" + nacos );
//        System.err.println( "mysqlNm原始明文密码加密后的结果为：" + mysqlNm );
//        System.err.println( "mysqlPs原始明文密码加密后的结果为：" + mysqlPs );
//        System.err.println( "redis原始明文密码加密后的结果为：" + redis );
    }


    private String encrypt( String originPassord ) {
        return encryptor.encrypt( originPassord );
    }

    private String decrypt( String encryptedPassword ) {
        return encryptor.decrypt( encryptedPassword );
    }
}
