All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gitee.easyopen.config.processor.UpdateSecretConfigProcessor Maven / Gradle / Ivy

Go to download

一个简单易用的接口开放平台,平台封装了常用的参数校验、结果返回等功能,开发者只需实现业务代码即可。https://gitee.com/durcframework/easyopen

The newest version!
package com.gitee.easyopen.config.processor;

import com.gitee.easyopen.ApiContext;
import com.gitee.easyopen.bean.Consts;
import com.gitee.easyopen.config.ConfigClient;
import com.gitee.easyopen.config.NettyOpt;
import io.netty.channel.Channel;
import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;

/**
 * 更新秘钥配置
 * @author tanghc
 */
public class UpdateSecretConfigProcessor extends AbstractNettyProcessorNoLock {

    public UpdateSecretConfigProcessor(ConfigClient configClient, NettyOpt nettyOpt) {
        super(configClient, nettyOpt);
    }

    @Override
    protected void doProcess(Channel channel, String data) {
        logger.info("配置中心推送秘钥设置");
        try {
            String localConfigFile = ApiContext.getApiConfig().getLocalSecretConfigFile();
            FileUtils.write(new File(localConfigFile), data, Consts.UTF8);
            this.configClient.getAppSecretManager().loadSecretCache(data);
        } catch (IOException e) {
            logger.error("配置中心推送秘钥写文件失败", e);
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy