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

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

Info

Publication number
CN111339736A
CN111339736A CN202010100657.0A CN202010100657A CN111339736A CN 111339736 A CN111339736 A CN 111339736A CN 202010100657 A CN202010100657 A CN 202010100657A CN 111339736 A CN111339736 A CN 111339736A
Authority
CN
China
Prior art keywords
name
key
configuration
prefix
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.)
Granted
Application number
CN202010100657.0A
Other languages
Chinese (zh)
Other versions
CN111339736B (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

Images

Landscapes

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

Abstract

The application relates to a prefix name adding method, a configuration obtaining device and electronic equipment, and belongs to the technical field of network communication. The method comprises the following steps: acquiring a project name of a target project; judging whether a prefix name needs to be added to the key under the item name; if yes, adding a prefix name to each key in the target item, so that in the process of acquiring the configuration corresponding to each key in the target item, acquiring the configuration corresponding to the key from a configuration center based on the key added with the prefix name. In the embodiment of the application, the prefix name is automatically added to the key in the project and is changed into the key meeting 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 high possibility of errors caused by manually adding the prefix name to each key in the project are solved.

Description

Method for adding prefix name, configuration acquisition method and 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 configuration obtaining method, a device and electronic equipment.
Background
Due to the development of the internet, the user group is larger and larger, the number of netizens is larger and larger, the corresponding request amount is larger and larger, the conventional centralized project of a single machine cannot meet the increasing request, and more companies deploy the project in a distributed mode at present so as to deal with the large request amount to ensure that the server of the company cannot be down.
Many middleware for distributed scenarios are also spawned, and the configuration center is one of them. According to the method of a single machine in the prior art, the configuration required to be used in the project is written in the project, and when a certain configuration needs to be changed, the corresponding configuration is changed in the project, and then the server is restarted. This approach has a drawback: projects need to be restarted, if frequent reconfiguration is needed, the projects need to be restarted frequently, and the workload of developers is increased. In the case of a distributed project, a project is deployed on dozens or even hundreds of machines, and it is unreasonable to restart dozens or hundreds of machines after one configuration change. And after the project uses the configuration center, all the needed configurations are added into the configuration center, all the projects go to 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 the machines in real time without restarting the project and excessive manual operation.
When the configuration in a certain project needs to be changed, the key (key) for acquiring the configuration in the project needs to be changed, otherwise, the configuration can be acquired only according to the original key of the user, but the key in the original project does not meet the specification, so the configuration cannot be acquired by using the original key, the key in the project needs to be changed into the key meeting the specification, the current mode is to manually change the key in the project into the key meeting the specification, the number of the keys in one project is dozens to hundreds of different, the total number of the projects is 200 and 300, and the work load is certainly huge.
Disclosure of Invention
In view of this, an object of the present application is to provide a method, a configuration obtaining method, an apparatus, and an electronic device for adding a prefix name, so as to solve the problems that, when an existing project is modified, a prefix needs to be manually added to a key in the project, which results in a large workload and is prone to errors.
The embodiment of the application is realized as follows:
in a first aspect, an embodiment of the present application provides a method for adding a prefix name, including: acquiring a project name of a target project; judging whether a prefix name needs to be added to the key under the item name; if yes, adding a prefix name to each key in the target item, so that in the process of acquiring the configuration corresponding to each key in the target item, acquiring the configuration corresponding to the key from a configuration center based on the key added with the prefix name. In the embodiment of the application, by acquiring the project name of the target project of the access party, and then judging whether the prefix name needs to be added to the key under the project name, if so, the prefix name is added to each key in the target project and changed into the key meeting 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 high possibility of errors caused by manually adding the prefix name to each key in the project are solved.
With reference to a possible implementation manner of the embodiment of the first aspect, the 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 the key under the item name or not based on the configuration switch. In the embodiment of the application, when judging whether prefix names need to be added to keys under the item names, a first acquisition request for acquiring a configuration switch is sent to a configuration center based on the item names, and whether the prefix names need to be added to the keys under the item names is judged based on the configuration switch returned by the configuration center, so that whether the prefix names need to be added to the keys under the item names can be conveniently set according to needs, a user can flexibly select whether the function needs to be used, and the applicability of the scheme is improved.
With reference to a possible implementation manner of the embodiment of the first aspect, sending a first obtaining request to a configuration center based on the item name includes: generating a first key for acquiring the configuration switch based on the item name, wherein the first key comprises the item name; 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 item name, so that when the first key is applied to different item names, only the item name in the first key needs to be modified, and the process can be simplified.
With reference to a possible implementation manner of the embodiment of the first aspect, 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 prefixes to all keys in the target item by taking the item name as a prefix name; and if so, adding prefixes to all keys in the target item by preset prefix names. In the embodiment of the application, when adding prefix names to each key in a target item, whether prefix names are preset for the target item is judged first, if yes, prefixes are added to each key in the target item by using the preset prefix names, and if not, prefixes are added to each key in the target item by using the item name as the prefix name, so that the manner of adding the prefixes is flexible.
With reference to a possible implementation manner of the embodiment of the first aspect, the 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 second acquisition request carries the project name; 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 the 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 preset condition of the prefix name is sent to the configuration center based on the item name, and whether the prefix name needs to be preset for the target item is judged based on the preset condition of the prefix name 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 obtaining the target key, obtaining a configuration switch for representing whether a prefix name needs to be added to the target key; and if the configuration switch represents that a prefix name needs to be added 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. In the embodiment of the application, in the configuration process of obtaining the target key, a configuration switch for representing whether the prefix name needs to be added to the target key is obtained, if the configuration switch represents that the prefix name needs to be added to the target key, the prefix name is added to the target key, corresponding configuration is obtained from a configuration center based on the target key added with the prefix name, the prefix name is automatically added to the target key and is changed into a key meeting 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 easiness in errors caused by manually adding the prefix name to each key in a project are solved.
With reference to a possible implementation manner of the embodiment of the second aspect, after obtaining the 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 representation 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 representation of the configuration switch 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, the compatibility of low versions is realized, and the original use behavior is not changed and influenced when the user does not use the function of the invention.
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 a prefix name to each key in the target item when the key is yes, so that the configuration corresponding to each key is obtained from a configuration center based on the key added with the prefix name in the process of obtaining the configuration corresponding to each key in the target item.
In a fourth aspect, an embodiment of the present application further provides a configuration obtaining apparatus, including: the device comprises an acquisition module and a configuration acquisition module; the device comprises an acquisition module, a configuration module and a display module, wherein the acquisition module is used for acquiring a configuration switch for representing whether a prefix name needs to be added to a target key or not in the configuration process of acquiring the target key; and the configuration acquisition module is used for adding a prefix name to the target key if the configuration switch represents 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.
In a fifth aspect, an embodiment of the present application further provides an electronic device, including: a memory and a processor, the processor coupled to 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 according to the first aspect and/or any possible implementation manner of the first aspect, or to perform the method according to the second aspect.
In a sixth aspect, embodiments of the present application further provide a storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the method provided in the foregoing first aspect and/or any one of the possible implementation manners of the first aspect, or to perform the method provided in the foregoing second aspect.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the 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 needed to be used 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 it is obvious for those skilled in the art to obtain other drawings without creative efforts. The foregoing and other objects, features and advantages of the application will be apparent from the accompanying drawings. Like reference numerals refer to like parts throughout the drawings. The drawings are not intended to be to scale as practical, emphasis instead being placed upon illustrating the subject matter of the present application.
Fig. 1 shows a flowchart of a method for adding a prefix name according to an embodiment of the present application.
Fig. 2 shows a schematic flowchart of a configuration acquisition method provided in an embodiment of the present application.
Fig. 3 is a flowchart illustrating a further configuration acquisition method provided in an embodiment of the present application.
Fig. 4 shows a block diagram of a prefix name adding apparatus according to an embodiment of the present application.
Fig. 5 shows a block diagram of a configuration acquisition apparatus according to an embodiment of the present application.
Fig. 6 shows a schematic structural diagram of an electronic device provided in 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 drawings in the embodiments of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, relational terms such as "first," "second," and the like may be used solely in the description herein to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, 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 an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Further, the term "and/or" in the present application is only one kind of association relationship describing the associated object, and means that three kinds of relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone.
In view of the problems that when the existing old project is modified to be accessed to a configuration center (such as a Lion configuration center), the work load is large and errors are easy to occur due to the fact that prefix names need to be added to keys in the project manually. The embodiment of the application provides a method for adding prefix names, which changes the prefix names into keys meeting the specification by automatically adding the prefix names to the keys in a project, 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 names to the keys in the project are solved. The method for adding prefix names provided in the embodiment of the present application will be described below with reference to fig. 1.
Step S101: and acquiring the project name of the target project.
When a key in an old project (target project) needs to be modified, a client (namely a plug-in or a middleware) provided by the application is accessed, and the client can automatically acquire the project name of the target project of the access party during running. That is, when the user accesses the client code into the item code of the user, the client code automatically obtains the item name of the item code, so as to add a prefix to the key in the item code.
Step S102: and judging whether a prefix name needs to be added to the key under the item name.
After the item name of the target item is acquired, it is determined whether a prefix name needs to be added to a key (key) under the item name, and if necessary, step S103 is executed, otherwise, the process is ended.
Alternatively, the process of determining whether a 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 the key under the item name or not based on the configuration switch. After an item name of a target item is acquired, sending a first acquisition request to a configuration center such as a Lion configuration center based on the item name, wherein the first acquisition request is used for acquiring a configuration switch corresponding to the item name, and the configuration switch is used for representing whether a prefix name needs to be added to a key in the target item; after receiving the first acquisition request, the configuration center acquires a configuration switch corresponding to the item name carried in the first acquisition request, and then returns the configuration switch to the opposite end, after receiving the configuration switch corresponding to the item name returned by the configuration center in response to the first acquisition request, the client judges whether a prefix name needs to be added to the key under the item name or not 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, and if the configuration switch is closed, the prefix name does not need to be added to the key under the item name.
Optionally, the process of sending the first obtaining request to the configuration center based on the project name may be: generating a first key for acquiring the configuration switch based on the item name, wherein the first key comprises the item name; sending the first key to the configuration center. For example, if the item name is ymm-joba, the first key generated based on the item name may be ymm-joba. Wherein ymm-jobin the first key is an item name and lion. Wherein, the first key corresponding to different item names is different, namely the prefix (item name) of the first key is different in different items, and the suffix is the same.
The configuration switch may be configured (on or off) on the configuration center, and if the configuration switch is in the on state, it indicates that the prefix name needs to be added to the key under the item name, and if the configuration switch is in the off state, it indicates that the prefix name does not need to be added to the key under the item name.
The Lion configuration center is an application configuration management system, and all configurations used by applications are stored in a single system in a key/va/ue (value) pair mode.
Step S103: and adding a prefix name to each key in the target item, 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 a configuration center based on the key added with the prefix name.
And when a prefix name needs to be added to the key under the item name, adding the prefix name to each key in the target item, so that in the process of acquiring the configuration corresponding to each key in the target item, acquiring the configuration corresponding to the key from a configuration center based on the key added with the prefix name.
Optionally, the process of adding a prefix name to each key in the target item may be: judging whether a prefix name is preset for the target item; if not, adding prefixes to all keys in the target item by taking the item name as a prefix name; and if so, adding prefixes to all keys in the target item by preset prefix names. When adding prefix names to each key in a target item, it is first determined whether a prefix name is preset for the target item, if so, prefixes are added to each key in the target item by using the preset prefix name, and if not, prefixes can be added to each key in the target item by using the item name as the prefix name.
The process of determining whether the prefix name is preset for the target item may be: sending a second acquisition request to the configuration center based on the project name, wherein the second acquisition request carries the project name; 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 the 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 the prefix name preset condition corresponding to the project name. After receiving the second acquisition request, the configuration center acquires a prefix name preset condition corresponding to the item name based on the item name carried in the second acquisition request, and then returns the prefix name preset condition 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 in advance based on the prefix name preset condition. If the prefix name presetting condition returned by the configuration center is null, the prefix name is not preset for the target item in advance. If the prefix name preset condition is a specific prefix name, the prefix name preset for the target item is the prefix name.
Optionally, the process of sending the second obtaining request to the configuration center based on the project name may be: generating a second key for acquiring the preset condition of the prefix name based on the item name, wherein the second key comprises the item name; sending the second key to the configuration center. For example, if the item name is ymm-job, then the second key generated based on the item name may be ymm-job. And the ymm-jobin the second key is an item name, and the lion.
In the embodiment of the application, after a business party accesses a client, the client can acquire the project name of a target project of the access party and then judges whether prefix names need to be added to keys under the project name, if yes, the prefix names are added to all keys in the target project and changed into keys meeting the specification, so that a user can acquire correct configuration without any code change, the repeated labor of the business party is greatly reduced, the business party can be enabled not to pay attention to the incompatibility problem caused by accessing a new environment, the lossless access is realized, the problems of large workload and easiness in error caused by manually adding the prefix names to all keys in the project are solved, and more energy can be spent on the realization and optimization of the project function.
An embodiment of the present application further provides a configuration obtaining method, as shown in fig. 2, and the steps included in the configuration obtaining method will be described below with reference to fig. 2.
Step S201: and in the configuration process of obtaining the target key, obtaining a configuration switch for representing whether a prefix name needs 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 a prefix name needs to be added to the target key, and as an implementation mode, sending a first acquisition request for acquiring the configuration switch to a configuration center based on the item name 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 represents that a prefix name needs to be added 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.
And if the configuration switch represents that a prefix name needs to be added 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. And if the configuration switch representation does not need to add a prefix name to the target key, directly acquiring the corresponding configuration from the configuration center based on the target key.
The process of adding a prefix to the target key can refer to the above process of adding a prefix name to each key in the target item, and the principle process is similar. After the prefix is added, the corresponding configuration is obtained from the configuration center based on the target key added with the prefix name, and the process may be as follows: and sending a request for obtaining the configuration to the configuration center, wherein the request carries the target key added with the prefix name, so as to obtain the corresponding configuration from the configuration center. And if the corresponding configuration is not obtained from the configuration center based on the target key added with the prefix name, removing the prefix, and obtaining the corresponding configuration from the configuration center by using the original key. And if the original key does not acquire the corresponding configuration from the configuration center, acquiring the corresponding configuration from the local configuration file by the original key, and if the original key does not acquire the corresponding configuration from the local configuration file, directly throwing the exception, wherein the condition does not allow the project to be started. For ease of understanding, the process of obtaining the configuration may be referred to as a flow diagram shown in fig. 3.
The embodiment of the present application further provides an apparatus 100 for adding a prefix name, as shown in fig. 4. The apparatus 100 for adding prefix name includes: an acquisition module 110, a determination module 120, and an addition module 130.
The obtaining module 110 is configured to obtain a project name of the target project.
The judging module 120 is configured to judge whether a prefix name needs to be added to the key under the item name.
And if yes, adding a prefix name to each key in the target item, so as to obtain the configuration corresponding to each key from the configuration center based on the key to which the prefix name is added in the process of obtaining the configuration corresponding to each key in the target item.
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 the key under the item name or not 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 item name, wherein the first key comprises the item name; sending the first key to the configuration center.
Optionally, adding module 130 is configured to: judging whether a prefix name is preset for the target item; if not, adding prefixes to all keys in the target item by taking the item name as a prefix name; and if so, adding prefixes to all keys in the target item by preset prefix names. Optionally, adding module 130 is configured to: sending a second acquisition request to the configuration center based on the project name, wherein the second acquisition request carries the project name; 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 the prefix name is preset for the target item or not based on the prefix name preset condition.
The apparatus 100 for adding prefix name provided in the embodiment of the present application has the same implementation principle and technical effect as the foregoing method embodiment, and for brief description, reference may be made to the corresponding contents in the foregoing method embodiment for the part of the embodiment of the apparatus that is not mentioned.
The embodiment of the present application further provides a configuration acquiring apparatus 200, as shown in fig. 5. The configuration acquisition apparatus 200 includes: an acquisition module 210 and a configuration acquisition module 220.
An obtaining module 210, configured to obtain, in a process of obtaining configuration of a target key, a configuration switch used for representing whether a prefix name needs to be added to the target key.
A configuration obtaining module 220, configured to add a prefix name to the target key if the configuration switch representation needs to add the prefix name 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, based on the target key, a corresponding configuration from the configuration center if the configuration switch representation does not need to add a prefix name to the target key.
The implementation principle and the resulting technical effect of the configuration obtaining apparatus 200 provided in the embodiment of the present application are the same as those of the foregoing method embodiment, and for the sake of brief description, no mention is made in the apparatus embodiment, and reference may be made to the corresponding contents in the foregoing method embodiment.
As shown in fig. 6, fig. 6 shows a block diagram of an electronic device 300 provided in an embodiment of the present application, where the electronic device 300 may be loaded with a client (a plug-in or a 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 to each other directly or indirectly to realize data transmission or interaction. For example, these 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 receive and transmit a configuration message. The memory 320 is used for storing a computer program, such as a software functional module shown in fig. 4 or fig. 5, that is, the apparatus 100 for adding a prefix name shown in fig. 4 or the configuration acquisition apparatus 200 shown in fig. 5. The prefix name adding apparatus 100 or the configuration acquiring apparatus 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 solidified in an Operating System (OS) of the electronic device 300. The processor 340 is configured to execute an executable module stored in the memory 320, such as a software function module or a computer program included in the apparatus 100 for adding a prefix name or the configuration acquiring apparatus 200. For example, when the processor 340 executes the apparatus 100 for adding a prefix name shown in fig. 4, the processor 340 is configured to obtain an item name of the target item; judging whether a prefix name needs to be added to the key under the item name; if yes, adding a prefix name to each key in the target item, so that in the process of acquiring the configuration corresponding to each key in the target item, acquiring the configuration corresponding to the key from a configuration center based on the key added with the prefix name. For another example, when the processor 340 executes the configuration acquiring apparatus 200 shown in fig. 5, the processor 340 is configured to acquire a configuration switch used for characterizing whether a prefix name needs to be added to the target key in the process of acquiring the configuration of the target key; and if the configuration switch represents that a prefix name needs to be added 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.
The Memory 320 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like.
Processor 340 may be an integrated circuit chip having signal processing capabilities. The processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A 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 present embodiment also provides a non-volatile computer-readable storage medium (hereinafter, referred to as a storage medium), where the storage medium stores a computer program, and when the computer program is run by the electronic device 300, the computer program executes the method for adding a prefix name or the method for obtaining a configuration as described above.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures 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 an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent 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 such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a notebook computer, a server, or an electronic device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by 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 (10)

1. A method for adding prefix names, comprising:
acquiring a project name of a target project;
judging whether a prefix name needs to be added to the key under the item name;
if yes, adding a prefix name to each key in the target item, so that in the process of acquiring the configuration corresponding to each key in the target item, acquiring the configuration corresponding to the key from a configuration center based on the key added with the 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 the key under the item name or not 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 item name, wherein the first key comprises the item name;
sending the first key to the configuration center.
4. The method of claim 1, wherein adding prefix names to the keys in the target item comprises:
judging whether a prefix name is preset for the target item;
if not, adding prefixes to all keys in the target item by taking the item name as a prefix name;
and if so, adding prefixes to all keys in the target item by preset prefix names.
5. The method of claim 4, wherein determining whether a prefix name is preset for the target item comprises:
sending a second acquisition request to the configuration center based on the project name, wherein the second acquisition request carries the project name;
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 the prefix name is preset for the target item or not based on the prefix name preset condition.
6. A method for configuration acquisition, comprising:
in the configuration process of obtaining the target key, obtaining a configuration switch for representing whether a prefix name needs to be added to the target key;
and if the configuration switch represents that a prefix name needs to be added 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.
7. An apparatus for adding prefix names, 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;
and the adding module is used for adding a prefix name to each key in the target item when the key is yes, so that the configuration corresponding to each key is obtained from a configuration center based on the key added with the prefix name in the process of obtaining the configuration corresponding to each key in the target item.
8. A configuration acquisition apparatus, comprising:
the device comprises an acquisition module, a configuration module and a display module, wherein the acquisition module is used for acquiring a configuration switch for representing whether a prefix name needs to be added to a target key or not in the configuration process of acquiring the target key;
and the configuration acquisition module is used for adding a prefix name to the target key if the configuration switch represents 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.
9. An electronic device, comprising:
a memory and a processor, the processor coupled to the memory;
the memory is used for storing programs;
the processor for invoking a program stored in the memory to perform the method of any one of claims 1-5 or to perform the method of claim 6.
10. A storage medium having stored thereon a computer program which, when executed by a processor, performs the method of any one of claims 1-5 or the method of claim 6.
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 true CN111339736A (en) 2020-06-26
CN111339736B 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 (5)

* 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
US20180032544A1 (en) * 2016-07-28 2018-02-01 Fujitsu Limited Distributed processing management method and distributed processing management apparatus
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

Patent Citations (5)

* 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
US20180032544A1 (en) * 2016-07-28 2018-02-01 Fujitsu Limited Distributed processing management method and distributed processing management apparatus
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
CN111339736B (en) 2023-09-01

Similar Documents

Publication Publication Date Title
CN107729041B (en) Application program hot updating method, device, terminal and storage medium
CN110263275B (en) Method and device for accessing webpage, mobile terminal and storage medium
CN111723313A (en) Page jump processing method, device, equipment and storage medium
CN111694592A (en) Management method and system for project version release
WO2019109519A1 (en) Service rule management method, apparatus and device, and computer-readable storage medium
CN113407383B (en) Main and standby system switching method and device, server and main and standby system
CN111221550B (en) Rule updating method and device for streaming computing and streaming computing system
CN109462507B (en) Configuration updating method, device and system and electronic equipment
US20180150365A1 (en) Disaster Recover of Managed Systems
CN114465998A (en) Multi-device file transmission method and device, terminal device and readable storage medium
CN112134918B (en) Method for detecting and processing matching state of function and trigger in cloud service
CN113656107A (en) Mobile application loading method and device and electronic equipment
CN112631646A (en) Data compatibility method, device and equipment for APP version degradation and storage medium
CN115495161B (en) BIOS option modification validation method and device and storage medium
CN111339736B (en) Method for adding prefix name, configuration acquisition method, device and electronic equipment
CN116303250A (en) Accounting archive data management method and device, electronic equipment and medium
CN113791809B (en) Application exception handling method and device and computer readable storage medium
CN115729590A (en) Service deployment method, device, equipment and computer readable storage medium
CN113986760A (en) Microservice Mock testing method and device, computer equipment and storage medium
CN111367634A (en) Information processing method, information processing device and terminal equipment
CN113656378A (en) Server management method, device and medium
CN112000354A (en) Version information updating method, version information updating device, version information updating equipment and storage medium
CN101452390A (en) Network boot method and system, and system boot method and apparatus
CN110868477A (en) Task scheduling method, device and system
CN111061576A (en) Method and system for creating entity object

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