CN111339736B - Method for adding prefix name, configuration acquisition method, device and electronic equipment - Google Patents

Method for adding prefix name, configuration acquisition method, device and electronic equipment Download PDF

Info

Publication number
CN111339736B
CN111339736B CN202010100657.0A CN202010100657A CN111339736B CN 111339736 B CN111339736 B CN 111339736B CN 202010100657 A CN202010100657 A CN 202010100657A CN 111339736 B CN111339736 B CN 111339736B
Authority
CN
China
Prior art keywords
name
prefix
key
configuration
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010100657.0A
Other languages
Chinese (zh)
Other versions
CN111339736A (en
Inventor
汪俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangsu Manyun Software Technology Co Ltd
Original Assignee
Jiangsu Manyun Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiangsu Manyun Software Technology Co Ltd filed Critical Jiangsu Manyun Software Technology Co Ltd
Priority to CN202010100657.0A priority Critical patent/CN111339736B/en
Publication of CN111339736A publication Critical patent/CN111339736A/en
Application granted granted Critical
Publication of CN111339736B publication Critical patent/CN111339736B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to a method for adding prefix names, a configuration acquisition method, a device and electronic equipment, and belongs to the technical field of network communication. The method comprises the following steps: acquiring the project name of a target project; judging whether a prefix name needs to be added to a key under the item name; and if yes, adding a prefix name to each key in the target item so as to acquire the configuration corresponding to each key in the target item from a configuration center based on the key added with the prefix name in the process of acquiring the configuration corresponding to each key. In the embodiment of the application, the prefix names are automatically added to the keys in the project to change the keys into keys conforming to the specifications, so that a user can acquire correct configuration without any code change, unnecessary workload is reduced, and the problems of large workload and easy error caused by adding the prefix names to each key in the project manually are solved.

Description

Method for adding prefix name, configuration acquisition method, device and electronic equipment
Technical Field
The application belongs to the technical field of network communication, and particularly relates to a prefix name adding method, a prefix name configuration obtaining device and electronic equipment.
Background
Because of the development of the internet, the user population is larger and the number of netizens is larger, the corresponding request amount is larger and larger, the ever-increasing requests cannot be met by the traditional centralized project of a single machine, and more companies deploy projects in a distributed mode to meet the large request amount so as to ensure that own servers cannot be down.
Many middleware for distributed scenarios are also spawned, one of which is the deployment center. According to the conventional method of a single machine, the configuration needed in the project is written in the project, and when a certain configuration needs to be changed, the server is restarted after the corresponding configuration is changed in the project. This approach has a drawback: the project needs to be restarted, and if frequent reconfiguration is needed, the project needs to be restarted frequently, so that the workload of developers is increased. In the case of distributed projects, where a project is deployed on tens or even hundreds of machines, it is quite unreasonable to restart tens or hundreds of machines by changing the configuration once. After the project uses the configuration center, all needed configurations are added in the configuration center, all projects are removed from the configuration center to obtain the configurations, when the configurations need to be changed, the configurations only need to be changed on the configuration center, and then the client side of the configuration center can update the configurations of all machines in real time, so that the project does not need to be restarted, and excessive manual operations are not needed.
When the configuration in a certain item needs to be changed, the keys (keys) used for obtaining the configuration in the item need to be changed, otherwise, the configuration can only be obtained according to the original keys of the user, but the keys in the original item do not meet the specification, so the original keys cannot be used for obtaining the configuration, the keys in the item need to be changed into the keys meeting the specification, the current mode is to manually change the keys in the item into the keys meeting the specification, the number of the keys in one item is tens to hundreds of different, and the total number of the items is 200-300 different, which is definitely a huge workload.
Disclosure of Invention
In view of the above, the present application aims to provide a method for adding prefix names, a configuration obtaining method, a device and an electronic apparatus, so as to solve the problems that when an existing project is modified, manual prefix addition is required to be performed on keys in the project, resulting in large workload and easy error.
Embodiments of the present application are implemented as follows:
in a first aspect, an embodiment of the present application provides a method for adding a prefix name, including: acquiring the project name of a target project; judging whether a prefix name needs to be added to a key under the item name; and if yes, adding a prefix name to each key in the target item so as to acquire the configuration corresponding to each key in the target item from a configuration center based on the key added with the prefix name in the process of acquiring the configuration corresponding to each key. In the embodiment of the application, the item name of the target item of the access party is obtained, then whether the prefix name needs to be added to the key under the item name is judged, if yes, the prefix name is added to each key in the target item and is changed into the key conforming to the specification, so that a user can obtain correct configuration without any code change, unnecessary workload is reduced, and the problems of large workload and easy error caused by manually adding the prefix name to each key in the item are solved.
With reference to a possible implementation manner of the first aspect embodiment, determining whether a prefix name needs to be added to a key under the item name includes: sending a first acquisition request to the configuration center based on the project name, wherein the first acquisition request carries the project name; receiving a configuration switch corresponding to the item name returned by the configuration center in response to the first acquisition request, wherein the configuration switch is used for representing whether a prefix name needs to be added to a key in the target item; and judging whether a prefix name needs to be added to a key under the item name based on the configuration switch. In the embodiment of the application, when judging whether the prefix name needs to be added to the key under the item name, the first acquisition request for acquiring the configuration switch is sent to the configuration center based on the item name, and whether the prefix name needs to be added to the key under the item name is judged based on the configuration switch returned by the configuration center, so that whether the prefix name needs to be added to the key under the item name can be conveniently set according to the needs, a user can flexibly select whether to use the function, and the applicability of a scheme is improved.
With reference to a possible implementation manner of the first aspect, sending a first obtaining request to a configuration center based on the project name includes: generating a first key for acquiring the configuration switch based on the project name, wherein the first key comprises the project name; and sending the first key to the configuration center. In the embodiment of the application, when the first acquisition request is sent to the configuration center, the first key for acquiring the configuration switch is generated based on the project name, so that when the first key is applied to different project names, only the project name in the first key is required to be modified, and the flow can be simplified.
With reference to a possible implementation manner of the first aspect embodiment, adding a prefix name to each key in the target item includes: judging whether a prefix name is preset for the target item; if not, adding a prefix to each key in the target item by taking the item name as a prefix name; and if yes, adding a prefix to each key in the target item by using a preset prefix name. In the embodiment of the application, when each key in the target item is added with the prefix name, whether the prefix name is preset for the target item is judged first, if yes, each key in the target item is added with the prefix by the preset prefix name, and if not, each key in the target item is added with the prefix by the item name as the prefix name, so that the mode of adding the prefix is flexible.
With reference to a possible implementation manner of the first aspect embodiment, determining whether a prefix name is preset for the target item includes: sending a second acquisition request to the configuration center based on the project name, wherein the project name is carried in the second acquisition request; receiving a prefix name preset condition corresponding to the item name returned by the configuration center in response to the second acquisition request; and judging whether a prefix name is preset for the target item or not based on the prefix name preset condition. In the embodiment of the application, when judging whether the prefix name is preset for the target item, the second acquisition request for acquiring the prefix name preset condition is sent to the configuration center based on the item name, and whether the prefix name is preset for the target item is judged based on the prefix name preset condition returned by the configuration center, so that whether the prefix name is preset for the target item can be conveniently known, and the practicability of the scheme is improved.
In a second aspect, an embodiment of the present application further provides a configuration obtaining method, including: in the configuration process of acquiring a target key, acquiring a configuration switch for representing whether prefix names need to be added to the target key; and if the configuration switch characterization needs to add the prefix name to the target key, adding the prefix name to the target key, and acquiring the corresponding configuration from a configuration center based on the target key added with the prefix name. In the embodiment of the application, in the configuration process of acquiring the target key, a configuration switch for representing whether the target key needs to be added with a prefix is obtained, if the configuration switch represents that the target key needs to be added with the prefix, the prefix is added to the target key, and corresponding configuration is acquired from a configuration center based on the target key added with the prefix, and the prefix is automatically added to the target key to change the target key into a key conforming to the specification, so that a user can acquire correct configuration without any code change, unnecessary workload is reduced, and the problems of large workload and easiness in error caused by manually adding the prefix to each key in an item are solved.
With reference to a possible implementation manner of the second aspect embodiment, after obtaining a configuration switch for characterizing whether a prefix name needs to be added to the target key, the method further includes: and if the configuration switch characterization does not need to add a prefix name to the target key, acquiring corresponding configuration from the configuration center based on the target key. In the embodiment of the application, if the configuration switch characterization does not need to add the prefix name to the target key, the corresponding configuration is directly obtained from the configuration center based on the target key, so that a user can flexibly select whether to use the configuration function of adding the prefix name, thereby realizing compatibility of a low version, and the original use behavior is not changed and influenced when the function of the application is not used.
In a third aspect, an embodiment of the present application further provides an apparatus for adding a prefix name, including: the device comprises an acquisition module, a judgment module and an addition module; the acquisition module is used for acquiring the project name of the target project; the judging module is used for judging whether a prefix name needs to be added to the key under the item name; and the adding module is used for adding prefix names to the keys in the target item when the key is yes, so that in the process of acquiring the configuration corresponding to each key in the target item, the configuration corresponding to the key is acquired from the configuration center based on the key added with the prefix names.
In a fourth aspect, an embodiment of the present application further provides a configuration obtaining apparatus, including: the acquisition module is configured; the acquisition module is used for acquiring a configuration switch used for representing whether prefix names need to be added to the target keys in the configuration process of acquiring the target keys; and the configuration acquisition module is used for adding the prefix name to the target key if the configuration switch characterizes that the prefix name needs to be added to the target key, and acquiring the corresponding configuration from the configuration center based on the target key added with the prefix name.
In a fifth aspect, an embodiment of the present application further provides an electronic device, including: the device comprises a memory and a processor, wherein the processor is connected with the memory; the memory is used for storing programs; the processor is configured to invoke a program stored in the memory, so as to perform the above-mentioned embodiment of the first aspect and/or a method provided in combination with any possible implementation manner of the embodiment of the first aspect, or perform the method provided by the embodiment of the second aspect.
In a sixth aspect, embodiments of the present application further provide a storage medium having stored thereon a computer program which, when executed by a processor, performs the method provided by the embodiments of the first aspect and/or any one of the possible implementations of the embodiments of the first aspect, or performs the method provided by the embodiments of the second aspect.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the embodiments of the application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and drawings.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. The above and other objects, features and advantages of the present application will become more apparent from the accompanying drawings. Like reference numerals refer to like parts throughout the several views of the drawings. The drawings are not intended to be drawn to scale, with emphasis instead being placed upon illustrating the principles of the application.
Fig. 1 shows a flowchart of a method for adding prefix names according to an embodiment of the present application.
Fig. 2 shows a flowchart of a configuration acquisition method according to an embodiment of the present application.
Fig. 3 is a schematic flow chart of another configuration obtaining method according to an embodiment of the present application.
Fig. 4 is a block diagram of an apparatus for adding a prefix name according to an embodiment of the present application.
Fig. 5 shows a block diagram of a configuration acquisition device according to an embodiment of the present application.
Fig. 6 shows a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, relational terms such as "first," "second," and the like may be used solely to distinguish one entity or action from another entity or action in the description of the application without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Furthermore, the term "and/or" in the present application is merely an association relationship describing the association object, and indicates that three relationships may exist, for example, a and/or B may indicate: a exists alone, A and B exist together, and B exists alone.
In view of the problems that when the existing old project is transformed into an access configuration center (such as a Lion configuration center), prefix names are required to be manually added to all keys in the project, so that the workload is large and the error is easy to occur. The embodiment of the application provides a method for adding prefix names, which automatically adds the prefix names to keys in items and changes the keys into keys conforming to specifications, so that a user can acquire correct configuration without any code change, unnecessary workload is reduced, and the problems of large workload and easy error caused by manually adding the prefix names to each key in the items are solved. The method for adding prefix names according to the embodiment of the present application will be described below with reference to fig. 1.
Step S101: the item name of the target item is acquired.
When the key in an old item (target item) needs to be modified, the client (namely a plug-in or a middleware) provided by the application is accessed, and the client automatically acquires the item name of the target item of the access party during operation. That is, when the user accesses the client code into the item code, the client code automatically acquires the item name of the item code so as to prefix the key in the item code.
Step S102: and judging whether a prefix name needs to be added to a key under the item name.
After the item name of the target item is acquired, it is determined whether or not a prefix name needs to be added to a key (key) under the item name, if so, step S103 is executed, and otherwise, the process is ended.
Alternatively, the process of determining whether the prefix name needs to be added to the key under the item name may be: sending a first acquisition request to the configuration center based on the project name, wherein the first acquisition request carries the project name; receiving a configuration switch corresponding to the item name returned by the configuration center in response to the first acquisition request, wherein the configuration switch is used for representing whether a prefix name needs to be added to a key in the target item; and judging whether a prefix name needs to be added to a key under the item name based on the configuration switch. After acquiring the project name of the target project, sending a first acquisition request to a configuration center such as a Lion configuration center based on the project name, wherein the first acquisition request is used for acquiring a configuration switch corresponding to the project name, and the configuration switch is used for representing whether a prefix name needs to be added to keys in the target project; after receiving the first obtaining request, the configuration center obtains a configuration switch corresponding to the item name based on the item name carried in the first obtaining request, then returns the configuration switch to the opposite end, and after receiving the configuration switch corresponding to the item name returned by the configuration center in response to the first obtaining request, the client judges whether the prefix name needs to be added to the key under the item name based on the configuration switch, if the configuration switch is opened, the prefix name needs to be added to the key under the item name is represented, and if the configuration switch is closed, the prefix name does not need to be added to the key under the item name.
Alternatively, the process of sending the first acquisition request to the configuration center based on the item name may be: generating a first key for acquiring the configuration switch based on the project name, wherein the first key comprises the project name; and sending the first key to the configuration center. For example, the item name is ymm-job, and the first key generated based on the item name may be ymm-job. Lion. Prefix. Enable. Wherein ymm-job in the first key is an item name, and lion. Prefix. Enable is a suffix of the acquisition configuration switch. Wherein the first keys corresponding to different item names are different, i.e. the prefixes (item names) of the first keys in different items are different, and the suffixes are the same.
The configuration switch may be configured in a configuration center, and if the configuration switch is in an on state, it indicates that a prefix name needs to be added to a key under the item name, and if the configuration switch is in an off state, it indicates that a prefix name does not need to be added to a key under the item name.
The Lion configuration center is a set of application configuration management system, and all configurations used by the application are stored in a single system and stored in a key/va value pair mode.
Step S103: and adding a prefix name to each key in the target item so as to acquire the configuration corresponding to each key in the target item from a configuration center based on the key added with the prefix name in the process of acquiring the configuration corresponding to the key.
When a prefix name needs to be added to a key under the item name, the prefix name is added to each key in the target item, so that in the process of obtaining the configuration corresponding to each key in the target item, the configuration corresponding to the key is obtained from the configuration center based on the key added with the prefix name.
Wherein, optionally, the process of adding prefix names to the keys in the target item may be: judging whether a prefix name is preset for the target item; if not, adding a prefix to each key in the target item by taking the item name as a prefix name; and if yes, adding a prefix to each key in the target item by using a preset prefix name. When adding a prefix name to each key in the target item, firstly judging whether a prefix name is preset for the target item, if yes, adding a prefix to each key in the target item by the preset prefix name, and if not, as an implementation mode, adding a prefix to each key in the target item by taking the item name as the prefix name.
The process of judging whether the target item is preset with a prefix name may be: sending a second acquisition request to the configuration center based on the project name, wherein the project name is carried in the second acquisition request; receiving a prefix name preset condition corresponding to the item name returned by the configuration center in response to the second acquisition request; and judging whether a prefix name is preset for the target item or not based on the prefix name preset condition. And the client sends a second acquisition request to the configuration center based on the project name, wherein the second acquisition request is used for acquiring prefix name preset conditions corresponding to the project name. After receiving the second obtaining request, the configuration center obtains the preset condition of the prefix name corresponding to the item name based on the item name carried in the second obtaining request, and then returns the preset condition of the prefix name to the opposite terminal. After receiving the prefix name preset condition corresponding to the item name returned by the configuration center in response to the second acquisition request, the client judges whether the prefix name is preset for the target item or not in advance based on the prefix name preset condition. If the preset condition of the prefix name returned by the configuration center is null, the prefix name is not preset for the target item in advance. If the preset condition of the prefix name is a specific prefix name, the preset prefix name for the target item is indicated to be the prefix name.
Wherein optionally, the process of sending the second acquisition request to the configuration center based on the item name may be: generating a second key for acquiring the prefix name preset condition based on the project name, wherein the second key comprises the project name; and sending the second key to the configuration center. For example, the item name is ymm-job, and the second key generated based on the item name may be ymm-job. Lion. Prefix. Name. Wherein ymm-job in the second key is an item name, and lion.prefix.name is a suffix for acquiring the preset condition of the prefix name.
In the embodiment of the application, after the business side accesses the client side, the client side can acquire the project name of the target project of the access side, then judges whether the prefix name needs to be added to the key under the project name, and if yes, adds the prefix name to each key in the target project, changes the key into the key conforming to the specification, so that the user can acquire the correct configuration without any code change, the repeated labor of the business side is greatly reduced, the incompatibility problem caused by accessing a new environment is not concerned, the lossless access is realized, and the problems of large workload and easy error caused by manually adding the prefix name to each key in the project are solved, thereby more energy can be spent on the realization and optimization of the project function.
The embodiment of the application also provides a configuration acquisition method, as shown in fig. 2, and the steps included in the configuration acquisition method will be described with reference to fig. 2.
Step S201: and in the configuration process of acquiring the target key, acquiring a configuration switch used for representing whether prefix names need to be added to the target key.
In the configuration process of acquiring the target key in the target item, acquiring a configuration switch for representing whether the prefix name needs to be added to the target key, as an implementation manner, a first acquisition request for acquiring the configuration switch is sent to a configuration center based on the item name so as to acquire the configuration switch for representing whether the prefix name needs to be added to the target key.
Step S202: and if the configuration switch characterization needs to add the prefix name to the target key, adding the prefix name to the target key, and acquiring the corresponding configuration from a configuration center based on the target key added with the prefix name.
And if the configuration switch characterization needs to add the prefix name to the target key, adding the prefix name to the target key, and acquiring the corresponding configuration from a configuration center based on the target key added with the prefix name. If the configuration switch representation does not need to add a prefix name to the target key, the corresponding configuration is directly obtained from the configuration center based on the target key.
The process of adding a prefix to the target key can be referred to as the process of adding a prefix name to each key in the target item, and the principle process is similar. After adding the prefix, acquiring the corresponding configuration from the configuration center based on the target key added with the prefix name, wherein the process can be as follows: and sending a request for acquiring the configuration to a configuration center, wherein the request carries the target key added with the prefix name so as to acquire the corresponding configuration from the configuration center. If the corresponding configuration is not obtained from the configuration center based on the target key added with the prefix name, the prefix is removed, and the corresponding configuration is obtained from the configuration center by the original key. If the corresponding configuration is not obtained from the configuration center by the original key, the corresponding configuration is obtained from the local configuration file by the original key, and if the corresponding configuration is not obtained from the local configuration file by the original key, the exception is thrown directly, and the project is not allowed to be started under the condition. For ease of understanding, the process of obtaining a configuration may be referred to as a flow diagram shown in fig. 3.
The embodiment of the application also provides a device 100 for adding the prefix name, as shown in fig. 4. The prefix name adding apparatus 100 includes: an acquisition module 110, a judgment module 120, and an addition module 130.
The obtaining module 110 is configured to obtain an item name of the target item.
A judging module 120, configured to judge whether a prefix name needs to be added to a key under the item name.
And the adding module 130 is configured to add a prefix name to each key in the target item when yes, so that in a process of obtaining the configuration corresponding to each key in the target item, the configuration corresponding to each key is obtained from the configuration center based on the key added with the prefix name.
Optionally, the determining module 120 is configured to: sending a first acquisition request to the configuration center based on the project name, wherein the first acquisition request carries the project name; receiving a configuration switch corresponding to the item name returned by the configuration center in response to the first acquisition request, wherein the configuration switch is used for representing whether a prefix name needs to be added to a key in the target item; and judging whether a prefix name needs to be added to a key under the item name based on the configuration switch. Optionally, the determining module 120 is configured to: generating a first key for acquiring the configuration switch based on the project name, wherein the first key comprises the project name; and sending the first key to the configuration center.
Optionally, the adding module 130 is configured to: judging whether a prefix name is preset for the target item; if not, adding a prefix to each key in the target item by taking the item name as a prefix name; and if yes, adding a prefix to each key in the target item by using a preset prefix name. Optionally, the adding module 130 is configured to: sending a second acquisition request to the configuration center based on the project name, wherein the project name is carried in the second acquisition request; receiving a prefix name preset condition corresponding to the item name returned by the configuration center in response to the second acquisition request; and judging whether a prefix name is preset for the target item or not based on the prefix name preset condition.
The device 100 for adding a prefix name according to the embodiment of the present application has the same implementation principle and technical effects as those of the foregoing method embodiment, and for brevity, reference may be made to the corresponding content in the foregoing method embodiment where the device embodiment portion is not mentioned.
The embodiment of the application also provides a configuration acquisition device 200, as shown in fig. 5. The configuration acquisition device 200 includes: an acquisition module 210, a configuration acquisition module 220.
The obtaining module 210 is configured to obtain, in a process of obtaining the configuration of the target key, a configuration switch for indicating whether a prefix name needs to be added to the target key.
And the configuration obtaining module 220 is configured to add a prefix name to the target key if the configuration switch characterizes that the prefix name needs to be added to the target key, and obtain a corresponding configuration from a configuration center based on the target key to which the prefix name is added.
The configuration obtaining module 220 is further configured to obtain, if the configuration switch representation does not require adding a prefix name to the target key, a corresponding configuration from the configuration center based on the target key.
The configuration obtaining apparatus 200 according to the embodiment of the present application has the same implementation principle and technical effects as those of the foregoing method embodiment, and for brevity, reference may be made to the corresponding content in the foregoing method embodiment where the apparatus embodiment portion is not mentioned.
As shown in fig. 6, fig. 6 shows a block diagram of an electronic device 300 according to an embodiment of the present application, where the electronic device 300 may be equipped with a client (plug-in or middleware) in the foregoing embodiment. The electronic device 300 includes: a communication module 310, a memory 320, a communication bus 330, and a processor 340.
The communication module 310, the memory 320, and the processor 340 are electrically connected directly or indirectly to each other to realize data transmission or interaction. For example, the components may be electrically coupled to each other via one or more communication buses 330 or signal lines. The communication module 310 is configured to send and receive configuration messages. The memory 320 is used to store a computer program such as the software function module shown in fig. 4 or 5, i.e., the prefix name adding apparatus 100 shown in fig. 4 or the configuration obtaining apparatus 200 shown in fig. 5. The prefix name adding device 100 or the configuration obtaining device 200 includes at least one software function module that may be stored in the memory 320 in the form of software or firmware (firmware) or be solidified in an Operating System (OS) of the electronic device 300. The processor 340 is configured to execute executable modules stored in the memory 320, such as a software function module or a computer program included in the apparatus 100 or the configuration obtaining apparatus 200 to which a prefix name is added. For example, when the processor 340 executes the prefix name adding apparatus 100 shown in fig. 4, the processor 340 is configured to obtain an item name of a target item; judging whether a prefix name needs to be added to a key under the item name; and if yes, adding a prefix name to each key in the target item so as to acquire the configuration corresponding to each key in the target item from a configuration center based on the key added with the prefix name in the process of acquiring the configuration corresponding to each key. For another example, when the processor 340 executes the configuration obtaining device 200 shown in fig. 5, the processor 340 is configured to obtain, in a configuration process for obtaining a target key, a configuration switch for indicating whether a prefix name needs to be added to the target key; and if the configuration switch characterization needs to add the prefix name to the target key, adding the prefix name to the target key, and acquiring the corresponding configuration from a configuration center based on the target key added with the prefix name.
The Memory 320 may be, but is not limited to, a random access Memory (Random Access Memory, RAM), a Read Only Memory (ROM), a programmable Read Only Memory (Programmable Read-Only Memory, PROM), an erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), an electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.
Processor 340 may be an integrated circuit chip with signal processing capabilities. The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. The general purpose processor may be a microprocessor or the processor 340 may be any conventional processor or the like.
The electronic device 300 includes, but is not limited to, a computer, a personal computer, and the like.
The embodiment of the present application further provides a non-volatile computer readable storage medium (hereinafter referred to as a storage medium) on which a computer program is stored, where the computer program, when executed by a computer such as the electronic device 300 described above, performs the method for adding a prefix name or the configuration obtaining method described above.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described as different from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are merely illustrative, for example, of the flowcharts and block diagrams in the figures that illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a notebook computer, a server, or an electronic device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (8)

1. A method of adding a prefix name, comprising:
acquiring the project name of a target project;
judging whether a prefix name needs to be added to a key under the item name;
if yes, adding a prefix name to each key in the target item so as to acquire the configuration corresponding to each key in the target item from a configuration center based on the key added with the prefix name in the process of acquiring the configuration corresponding to each key in the target item;
wherein adding a prefix name to each key in the target item includes:
sending a second acquisition request to the configuration center based on the project name, wherein the project name is carried in the second acquisition request;
receiving a prefix name preset condition corresponding to the item name returned by the configuration center in response to the second acquisition request;
judging whether a prefix name is preset for the target item or not based on the prefix name preset condition;
if not, adding a prefix to each key in the target item by taking the item name as a prefix name;
and if yes, adding a prefix to each key in the target item by using a preset prefix name.
2. The method of claim 1, wherein determining whether a prefix name needs to be added to a key under the item name comprises:
sending a first acquisition request to the configuration center based on the project name, wherein the first acquisition request carries the project name;
receiving a configuration switch corresponding to the item name returned by the configuration center in response to the first acquisition request, wherein the configuration switch is used for representing whether a prefix name needs to be added to a key in the target item;
and judging whether a prefix name needs to be added to a key under the item name based on the configuration switch.
3. The method of claim 2, wherein sending a first acquisition request to a configuration center based on the project name comprises:
generating a first key for acquiring the configuration switch based on the project name, wherein the first key comprises the project name;
and sending the first key to the configuration center.
4. A configuration acquisition method, comprising:
in the configuration process of acquiring a target key, acquiring a configuration switch for representing whether prefix names need to be added to the target key;
if the configuration switch characterization needs to add a prefix name to the target key, adding the prefix name to the target key, and acquiring corresponding configuration from a configuration center based on the target key added with the prefix name;
wherein adding a prefix name to the target key includes:
sending a second acquisition request to a configuration center based on the item name of the target item where the target key is located, wherein the second acquisition request carries the item name;
receiving a prefix name preset condition corresponding to the item name returned by the configuration center in response to the second acquisition request;
judging whether a prefix name is preset for the target item or not based on the prefix name preset condition;
if not, adding a prefix to the target key by taking the item name of the target item where the target key is located as the prefix name;
and if yes, adding a prefix to the target key by using a preset prefix name.
5. An apparatus for adding a prefix name, comprising:
the acquisition module is used for acquiring the project name of the target project;
the judging module is used for judging whether a prefix name needs to be added to the key under the item name;
the adding module is used for adding prefix names to all keys in the target item when the key is yes, so that in the process of obtaining the configuration corresponding to each key in the target item, the configuration corresponding to the key is obtained from the configuration center based on the key added with the prefix names;
the adding module is used for: sending a second acquisition request to the configuration center based on the project name, wherein the project name is carried in the second acquisition request; receiving a prefix name preset condition corresponding to the item name returned by the configuration center in response to the second acquisition request; judging whether a prefix name is preset for the target item or not based on the prefix name preset condition; if not, adding a prefix to each key in the target item by taking the item name as a prefix name; and if yes, adding a prefix to each key in the target item by using a preset prefix name.
6. A configuration acquisition apparatus, characterized by comprising:
the acquisition module is used for acquiring a configuration switch used for representing whether prefix names need to be added to the target keys in the configuration process of acquiring the target keys;
the configuration acquisition module is used for adding a prefix name to the target key if the configuration switch characterizes that the prefix name needs to be added to the target key, and acquiring corresponding configuration from a configuration center based on the target key added with the prefix name;
wherein, the configuration acquisition module is used for:
sending a second acquisition request to a configuration center based on the item name of the target item where the target key is located, wherein the second acquisition request carries the item name; receiving a prefix name preset condition corresponding to the item name returned by the configuration center in response to the second acquisition request; judging whether a prefix name is preset for the target item or not based on the prefix name preset condition; if not, adding a prefix to the target key by taking the item name of the target item where the target key is located as the prefix name; and if yes, adding a prefix to the target key by using a preset prefix name.
7. An electronic device, comprising:
the device comprises a memory and a processor, wherein the processor is connected with the memory;
the memory is used for storing programs;
the processor is configured to invoke a program stored in the memory to perform the method of any of claims 1-3 or to perform the method of claim 4.
8. A storage medium having stored thereon a computer program which, when executed by a processor, performs the method of any of claims 1-3 or performs the method of claim 4.
CN202010100657.0A 2020-02-18 2020-02-18 Method for adding prefix name, configuration acquisition method, device and electronic equipment Active CN111339736B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010100657.0A CN111339736B (en) 2020-02-18 2020-02-18 Method for adding prefix name, configuration acquisition method, device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010100657.0A CN111339736B (en) 2020-02-18 2020-02-18 Method for adding prefix name, configuration acquisition method, device and electronic equipment

Publications (2)

Publication Number Publication Date
CN111339736A CN111339736A (en) 2020-06-26
CN111339736B true CN111339736B (en) 2023-09-01

Family

ID=71185444

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010100657.0A Active CN111339736B (en) 2020-02-18 2020-02-18 Method for adding prefix name, configuration acquisition method, device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111339736B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105763508A (en) * 2014-12-16 2016-07-13 阿里巴巴集团控股有限公司 Data access method and application server
CN107357794A (en) * 2016-05-10 2017-11-17 北京京东尚科信息技术有限公司 Optimize the method and apparatus of the data store organisation of key value database
CN108614696A (en) * 2016-12-08 2018-10-02 腾讯科技(深圳)有限公司 The method and device that a kind of method that application makes, static library generate
CN109614411A (en) * 2018-11-19 2019-04-12 杭州复杂美科技有限公司 Date storage method, equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6700554B2 (en) * 2016-07-28 2020-05-27 富士通株式会社 Distributed processing management method, distributed processing management program, and distributed processing management device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105763508A (en) * 2014-12-16 2016-07-13 阿里巴巴集团控股有限公司 Data access method and application server
CN107357794A (en) * 2016-05-10 2017-11-17 北京京东尚科信息技术有限公司 Optimize the method and apparatus of the data store organisation of key value database
CN108614696A (en) * 2016-12-08 2018-10-02 腾讯科技(深圳)有限公司 The method and device that a kind of method that application makes, static library generate
CN109614411A (en) * 2018-11-19 2019-04-12 杭州复杂美科技有限公司 Date storage method, equipment and storage medium

Also Published As

Publication number Publication date
CN111339736A (en) 2020-06-26

Similar Documents

Publication Publication Date Title
CN108845816B (en) Application program updating method, system, computer device and storage medium
CN106462430B (en) Application upgrade package obtaining method and device
CN111723313A (en) Page jump processing method, device, equipment and storage medium
CN111064626B (en) Configuration updating method, device, server and readable storage medium
CN113407383B (en) Main and standby system switching method and device, server and main and standby system
CN110597918A (en) Account management method and device and computer readable storage medium
WO2019109519A1 (en) Service rule management method, apparatus and device, and computer-readable storage medium
CN109614559A (en) Data processing method and device
CN113691635A (en) Method and device for calling micro service, electronic equipment and readable storage medium
US20050108704A1 (en) Software distribution application supporting verification of external installation programs
CN107623581B (en) Service list generation method, device and system, and acquisition and reporting method and device
CN114647422A (en) Vehicle electronic control unit flashing method, device, equipment and medium
CN111339736B (en) Method for adding prefix name, configuration acquisition method, device and electronic equipment
CN112631646A (en) Data compatibility method, device and equipment for APP version degradation and storage medium
CN112181049A (en) Cluster time synchronization method, device, system, equipment and readable storage medium
CN115495161B (en) BIOS option modification validation method and device and storage medium
CN110795137B (en) Authority configuration method, device, system, electronic equipment and readable medium
CN115617577A (en) Virtual disk backup method, device, equipment and medium
CN115729590A (en) Service deployment method, device, equipment and computer readable storage medium
CN112685102A (en) Gateway plug-in hot loading method, device, equipment and medium
CN113132241A (en) ACL template dynamic configuration method and device
CN111078257A (en) Loading method and related device of H5 application package
CN111104415A (en) Time zone updating method, time zone updating device, electronic equipment and storage medium
CN112579189A (en) Configuration file updating method and device
Jesus et al. ID generation in mobile environments

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant