function _M.init()

in lib/shenyu/register/nacos.lua [201:245]


function _M.init(conf)
    _M.storage = conf.shenyu_storage
    _M.balancer = balancer.new(conf.balancer_type)

    _M.revision = 0

    if ngx.worker.id() == 0 then
        _M.nacos_base_url = conf.nacos_base_url
        _M.username = conf.username
        _M.password = conf.password
        _M.namespace = conf.namespace
        _M.group_name = conf.group_name
        _M.service_name = conf.service_name
        _M.clusters = conf.clusters

        if not conf.clusters then
            _M.clusters = ""
        end
        if not conf.namespace then
            _M.namespace = ""
        end
        if not conf.group_name then
            _M.group_name = "DEFAULT_GROUP"
        end
        if not conf.service_name then
            _M.service_name = "shenyu-instances"
        end

        _M.server_list = {}
        _M.storage:set("revision", 0)

        
        local ok, err = ngx_timer_at(0, subscribe)
        if not ok then
            log(ERR, "failed to start watch: " .. err)
        end
        return
    end

    
    local ok, err = ngx_timer_at(2, sync)
    if not ok then
        log(ERR, "failed to start sync ", err)
    end
end