bzp2010 commented on code in PR #12179:
URL: https://github.com/apache/apisix/pull/12179#discussion_r2077199168


##########
apisix/admin/standalone.lua:
##########
@@ -0,0 +1,219 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+local type         = type
+local pairs        = pairs
+local ipairs       = ipairs
+local tonumber     = tonumber
+local tostring     = tostring
+local str_lower    = string.lower
+local ngx          = ngx
+local get_method   = ngx.req.get_method
+local shared_dict  = ngx.shared["standalone-config"]
+local table_insert = table.insert
+local table_new    = require("table.new")
+local yaml         = require("lyaml")
+local events       = require("apisix.events")
+local core         = require("apisix.core")
+local config_yaml  = require("apisix.core.config_yaml")
+local check_schema = require("apisix.core.schema").check
+
+local EVENT_UPDATE = "standalone-api-configuration-update"
+
+local _M = {}
+
+
+local function update_and_broadcast_config(apisix_yaml, conf_version)
+    local config = core.json.encode({
+        conf = apisix_yaml,
+        conf_version = conf_version,
+    })
+
+    if shared_dict then
+        -- the worker that handles Admin API calls is responsible for writing 
the shared dict
+        local ok, err = shared_dict:set("config", config)
+        if not ok then
+            return nil, "failed to save config to shared dict: " .. err
+        end
+        ngx.log(ngx.NOTICE, "standalone config updated: ", config)

Review Comment:
   Fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to