CN114237633A - Application configuration method, device, equipment and storage medium - Google Patents

Application configuration method, device, equipment and storage medium Download PDF

Info

Publication number
CN114237633A
CN114237633A CN202111558253.7A CN202111558253A CN114237633A CN 114237633 A CN114237633 A CN 114237633A CN 202111558253 A CN202111558253 A CN 202111558253A CN 114237633 A CN114237633 A CN 114237633A
Authority
CN
China
Prior art keywords
application
configuration
configuration file
path
file
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.)
Pending
Application number
CN202111558253.7A
Other languages
Chinese (zh)
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.)
Ping An Securities Co Ltd
Original Assignee
Ping An Securities 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 Ping An Securities Co Ltd filed Critical Ping An Securities Co Ltd
Priority to CN202111558253.7A priority Critical patent/CN114237633A/en
Publication of CN114237633A publication Critical patent/CN114237633A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention belongs to the technical field of computers, and discloses an application configuration method, an application configuration device, application configuration equipment and a storage medium. The method comprises the following steps: when application configuration is carried out, acquiring application information of an application to be configured; determining a configuration file path and a configuration file loading sequence according to the application information of the application to be configured; acquiring a target configuration file according to the configuration file path; and loading the target configuration files according to the loading sequence of the configuration files. By the method, the path of the configuration file is determined according to the application information of the application to be configured, so that different applications to be configured can determine the specific path and the loading sequence of the configuration file, the corresponding configuration file is obtained according to the path of the configuration file, and the loading of the configuration file is completed according to the loading sequence of the configuration file, so that multiple applications to be configured with the same application information can obtain the same path and loading sequence of the configuration file, and the multiple applications to be configured can share the configuration.

Description

Application configuration method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an application configuration method, apparatus, device, and storage medium.
Background
At present, the configuration of an application program generally has two types of configuration management modes, one is single application configuration, and the other is a configuration management platform.
The single application configuration, which is a currently common configuration management manner, can be applied to the configuration parameters of the application program space, part of the schemes can use different configuration values according to the deployment environment, the configuration of the application program space is used as the common configuration, the single application configuration is suitable for common applications, and the shared configuration basically does not exist among the applications. The method has the disadvantages that a shared configuration mechanism is not available, and only a plurality of copies can be copied to the used application program space;
the configuration management platform, which is popular at present, is disconf and apollo, which provide powerful and comprehensive configuration management functions, can share configuration among different applications, can set configuration values separately according to environments, and provides functions of interface management, CloudConfig integration, high availability and the like, and the problem corresponding to the functions is that the system is relatively large and needs extra resource budget.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide an application configuration method, an application configuration device, application configuration equipment and a storage medium, and aims to solve the technical problem that how to share application configuration by using a small amount of machine resources in the prior art.
In order to achieve the above object, the present invention provides an application configuration method, including the steps of:
when application configuration is carried out, acquiring application information of an application to be configured;
determining a configuration file path and a configuration file loading sequence according to the application information of the application to be configured;
acquiring a target configuration file according to the configuration file path;
and loading the target configuration files according to the loading sequence of the configuration files.
Optionally, the obtaining application information of the application to be configured when performing application configuration includes:
acquiring the application type of the application to be configured, the group of the application, the name of an application process, the name of an application instance, the project of the application and the deployment environment of the application;
verifying the application type, the group where the application is located, the name of the application process, the name of the application instance, the project where the application is located and the application deployment environment;
and when the verification is passed, generating application information according to the application type, the group where the application is located, the application process name, the application instance name, the project where the application is located and the application deployment environment.
Optionally, after the verifying the application type, the group in which the application is located, the name of the application process, the name of the application instance, the project in which the application is located, and the application deployment environment, the method further includes:
when the verification fails, prompting a user to add the configuration file of the application to be configured to obtain a newly added configuration file;
adding the application type, the application group, the application process name, the application instance name, the application project, the application deployment environment and the newly added configuration path of the newly added configuration file;
and sending the newly added configuration file and the newly added configuration path to a configuration server so that the configuration server creates the newly added configuration path and stores the newly added configuration file based on the newly added configuration path.
Optionally, the determining a configuration file path and a configuration file loading sequence according to the application information of the application to be configured includes:
acquiring a configuration sequence file;
determining a macro variable path in the configuration sequence file;
determining a macro variable to be replaced in the macro variable path according to the application information;
generating a configuration file path according to the application information and the macro variable to be replaced;
and determining the loading sequence of the configuration files according to the preset path sequence in the configuration sequence files.
Optionally, the obtaining the target configuration file according to the configuration file path includes:
sending the configuration file path to a configuration server so that the configuration server determines the path type of the configuration file path, when the path type is a merging path, determining the same configuration file according to the merging path, determining a distinguished configuration file according to the configuration file path, generating a configuration file to be loaded according to the same configuration file and the distinguished configuration file, and feeding back the configuration file to be loaded;
and determining a target configuration file according to the configuration file to be loaded.
Optionally, the determining a target configuration file according to the configuration file to be loaded includes:
acquiring a loaded configuration file of the application to be configured;
comparing the configuration file to be loaded with the loaded configuration file to obtain a difference configuration file;
and taking the difference configuration file as a target configuration file.
Optionally, after the target configuration file is loaded, obtaining a configured application;
detecting whether a configuration of the configured application is modified;
when the configuration of the configured application is modified, generating a modified configuration file according to the modified configuration;
determining a configuration file path corresponding to the modified configuration file;
and sending the modified configuration file and the configuration file path to the configuration server so that the configuration server updates the configuration file corresponding to the configuration file path according to the modified configuration file.
In addition, to achieve the above object, the present invention further provides an application configuration apparatus, including:
the information acquisition module is used for acquiring application information of an application to be configured when application configuration is carried out;
the configuration determining module is used for determining a configuration file path and a configuration file loading sequence according to the application information of the application to be configured;
the file acquisition module is used for acquiring a target configuration file according to the configuration file path;
and the configuration loading module is used for loading the target configuration file according to the loading sequence of the configuration file.
In addition, to achieve the above object, the present invention further provides an application configuration device, including: a memory, a processor and an application configuration program stored on the memory and executable on the processor, the application configuration program being configured to implement the steps of the application configuration method as described above.
Furthermore, to achieve the above object, the present invention further provides a storage medium having an application configuration program stored thereon, wherein the application configuration program, when executed by a processor, implements the steps of the application configuration method as described above.
The method comprises the steps of acquiring application information of an application to be configured when application configuration is carried out; determining a configuration file path and a configuration file loading sequence according to the application information of the application to be configured; acquiring a target configuration file according to the configuration file path; and loading the target configuration files according to the loading sequence of the configuration files. By the method, the path of the configuration file is determined according to the application information of the application to be configured, so that different applications to be configured can determine the specific path and the loading sequence of the configuration file, the corresponding configuration file is obtained according to the path of the configuration file, and the loading of the configuration file is completed according to the loading sequence of the configuration file, so that multiple applications to be configured with the same application information can obtain the same path and loading sequence of the configuration file, and the multiple applications to be configured can share the configuration.
Drawings
Fig. 1 is a schematic structural diagram of an application configuration device of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a configuration method according to a first embodiment of the present invention;
FIG. 3 is a flowchart illustrating a second embodiment of the application configuration method of the present invention at step S10;
FIG. 4 is a flowchart illustrating a third embodiment of the application configuration method of the present invention at step S20;
FIG. 5 is a flowchart illustrating a fourth embodiment of the application configuration method of the present invention at step S30;
fig. 6 is a block diagram of a first embodiment of an application configuration apparatus according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of an application configuration device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the application configuration device may include: a processor 1001, such as a Central Processing Unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a Wireless interface (e.g., a Wireless-Fidelity (Wi-Fi) interface). The Memory 1005 may be a Random Access Memory (RAM) Memory, or may be a Non-Volatile Memory (NVM), such as a disk Memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of the application configuration device, and may include more or fewer components than those shown, or some components in combination, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a storage medium, may include therein an operating system, a network communication module, a user interface module, and an application configuration program.
In the application configuration device shown in fig. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the application configuration device of the present invention may be disposed in the application configuration device, and the application configuration device calls the application configuration program stored in the memory 1005 through the processor 1001 and executes the application configuration method provided by the embodiment of the present invention.
An embodiment of the present invention provides an application configuration method, and referring to fig. 2, fig. 2 is a flowchart illustrating a first embodiment of an application configuration method according to the present invention.
In this embodiment, the application configuration method includes the following steps:
step S10: and acquiring application information of the application to be configured when the application is configured.
It should be noted that the application scenarios of this embodiment are as follows: the sharing of configuration among projects, groups, processes and deployment environments needs to be realized, unique configuration can be added, customized configuration is achieved, and extra deployment resource overhead does not need to be increased.
In particular implementations, an application configuration is a definition of an application. The method comprises the steps of constructing nodes in an Application, configuring the nodes, starting the nodes, and various pre-declaration information related to the Application, such as related data models, service models, and authority of required Application Programming Interfaces (APIs). Thus, the required configuration is different for different applications.
It is understood that the execution subject of the present embodiment may be a terminal device, for example, a computer, a server, or other devices that can run an application program. The terminal device runs an operating system, which may be Windows, Linux, MAC OS, etc., and this embodiment is not limited thereto.
It should be understood that the application information includes information of the application type, the application deployment environment, and the like. The application types comprise console application programs, single-document application programs, multi-document application programs, web-based application programs and the like, the application deployment environment refers to a general name of a series of hardware and software environments which are required or located when application project deployment is carried out, and a computer processor, a memory, a hard disk, an operating system and version, an operation authority, a database and version, a container, a cluster, a dependent mirror image and the like are common; the deployment environment imposes constraints or limitations on the deployment effort. Therefore, different configuration parameters exist in different deployment environments of the same application, so that the method is suitable for different deployment environments.
Step S20: and determining a configuration file path and a configuration file loading sequence according to the application information of the application to be configured.
It can be understood that, in different deployment environments, different application types correspond to different configuration files, all the configuration files are stored in the configuration server, and the corresponding configuration files can be found in the configuration server through configuration file paths.
It should be noted that there may be multiple configuration files in the same configuration file path, and when the application to be configured is configured by multiple configuration files, there exists a corresponding loading sequence when the configuration files are loaded, because there may exist a calling process between different configuration files, for example, configuration file 1 needs to be called when configuration file 2 is loaded, and configuration file 1 needs to be called after being loaded, so the loading sequence asks configuration file 1- > configuration file 2. The above are merely examples, and the present embodiment is not limited thereto. The configuration file loading sequence can be obtained from the arrangement sequence of the configuration files in the configuration file path, the configuration file path further comprises a configuration file loading sequence file besides the configuration files, and the configuration file loading sequence file stores the configuration file loading sequence.
In a specific implementation, the configuration file path is determined to be generated according to the application deployment environment and the application TYPE, for example, if the application deployment environment is ENV1 and the application TYPE is TYPE1, the configuration file path is generated as config/ENV1/TPYE1/ENV. The above are merely examples, and the present embodiment is not limited thereto.
Step S30: and acquiring a target configuration file according to the configuration file path.
It should be understood that, when asking about the security of the configuration file searching process, the terminal device calculates the paths of the configuration file through a preset abstract algorithm, generates a key value, and then sends the key value to the configuration server, because the configuration server calculates all the paths of the configuration file stored by the configuration server in advance through the same preset abstract algorithm, the preset key value is obtained, and a mapping relation is established between the preset key value and the corresponding path of the configuration file, after receiving the key value, the configuration server searches the corresponding path of the configuration file in the mapping relation through the key value, if the searching is successful, a target configuration file is determined according to the corresponding path of the configuration file, and the configuration server feeds back the target configuration file.
Step S40: and loading the target configuration files according to the loading sequence of the configuration files.
It should be understood that if there is only one target configuration file, the target configuration file is directly loaded, and if there are a plurality of target configuration files, the configuration file loading sequence file is first searched, the loading sequence of the plurality of configuration files is determined from the configuration file loading sequence file, and finally the plurality of target configuration files are loaded according to the configuration file loading sequence, so that the configuration loading of the application to be loaded is completed.
Further, after step S40, in order to ensure that the profile is in the state most suitable for the application at the moment, the method further includes: when the target configuration file is loaded, obtaining configured application; detecting whether a configuration of the configured application is modified; when the configuration of the configured application is modified, generating a modified configuration file according to the modified configuration; determining a configuration file path corresponding to the modified configuration file; and sending the modified configuration file and the configuration file path to the configuration server so that the configuration server updates the configuration file corresponding to the configuration file path according to the modified configuration file.
It should be noted that, when a user uses a configured application, the configuration of the application may be changed due to an abnormal application, and at this time, it is described that the previous configuration file is not completely adapted to the application, after the user modifies the configuration, the terminal device may prompt the user whether to upload the modified configuration, and after the user clicks the upload, the terminal device generates a configuration file (i.e., a modified configuration file) according to the modified configuration of the application, and a configuration file path of the modified configuration file is the same as a configuration file path of the target configuration file. And the terminal equipment sends the modified configuration file and the configuration file path to the configuration server, and the configuration server determines the corresponding configuration file which needs to be replaced and updated according to the configuration file path.
In the embodiment, when application configuration is performed, application information of an application to be configured is acquired; determining a configuration file path and a configuration file loading sequence according to the application information of the application to be configured; acquiring a target configuration file according to the configuration file path; and loading the target configuration files according to the loading sequence of the configuration files. By the method, the path of the configuration file is determined according to the application information of the application to be configured, so that different applications to be configured can determine the specific path and the loading sequence of the configuration file, the corresponding configuration file is obtained according to the path of the configuration file, and the loading of the configuration file is completed according to the loading sequence of the configuration file, so that multiple applications to be configured with the same application information can obtain the same path and loading sequence of the configuration file, and the multiple applications to be configured can share the configuration.
Referring to fig. 3, fig. 3 is a flowchart illustrating an application configuration method according to a second embodiment of the present invention.
Based on the first embodiment, in step S10, the configuration method applied in this embodiment includes:
step S11: and acquiring the application type of the application to be configured, the group of the application, the name of the application process, the name of the application instance, the project of the application and the deployment environment of the application.
It should be noted that the application types include a client and a service, that is, a client and a background service, where the client refers to an application end that directly interacts with a user, and the background service is a program that sets, modifies, monitors, and manages the client. Therefore, the client is greatly different from the background application, and the client is also greatly different from the background application in configuration.
The grouping of the applications means that a plurality of applications sharing the same configuration can be divided into the same group, so that the applications in the group can conveniently determine the path of the configuration file.
The application process name is used to distinguish between different applications, and thus the application process name generally defines the individual configuration of the application program corresponding to the application process name.
The application programs of different projects have unique configurations because different projects have their own project targets.
The application instance name refers to the name of the actual runtime of the application, and different application instances can be purposely added with different configurations.
The application deployment environment refers to an environment required by application installation and operation, different environments need different configurations, and the application deployment environment can be shared with other types of data.
Step S12: and verifying the application type, the group where the application is located, the name of the application process, the name of the application instance, the project where the application is located and the application deployment environment.
In a specific implementation, the configuration server stores configuration file paths of all configuration files, and the configuration file paths are composed of application types, groups where applications are located, application process names, application instance names, items where applications are located, and names corresponding to application deployment environments, so that the configuration server extracts keywords from the configuration file paths, and when the terminal device sends the application types, the groups where applications are located, the application process names, the application instance names, the items where applications are located, and the application deployment environments to the configuration server, the configuration server matches the information with the keywords, and when all the matching succeeds, it indicates that the application types, the groups where applications are located, the application process names, the application instance names, the items where applications are located, and the application deployment environments are all verified.
Step S13: and when the verification is passed, generating application information according to the application type, the group where the application is located, the application process name, the application instance name, the project where the application is located and the application deployment environment.
Further, in order to increase the extensibility of the configuration file, after the step S13, the method further includes: when the verification fails, prompting a user to add the configuration file of the application to be configured to obtain a newly added configuration file; adding the application type, the application group, the application process name, the application instance name, the application project, the application deployment environment and the newly added configuration path of the newly added configuration file; and sending the newly added configuration file and the newly added configuration path to a configuration server so that the configuration server creates the newly added configuration path and stores the newly added configuration file based on the newly added configuration path.
It should be noted that, when the verification fails, it is indicated that there is no corresponding configuration file path, at this time, the user is prompted to independently add configuration for the application to be configured, after the user is successfully added, a configuration file, that is, a newly added configuration file, is generated according to the current configuration of the application, the type of the newly added configuration file is determined according to the setting of the user, for example, a specific configuration is added to the application deployment environment, the configuration file path of the existing application deployment environment is acquired from the configuration server, and then the configuration file path of the newly added configuration file, that is, the newly added configuration path, is generated based on the known configuration file path and the application deployment environment of the application to be configured. For example, the configuration file path of the existing application deployment environment is config/common/dev/env.prop, where dev is the existing application deployment environment, and a new configuration path can be generated by replacing the existing application deployment environment with the application deployment environment of the application to be configured.
And after sending the newly added configuration file and the newly added configuration path to the configuration server, the configuration server establishes a storage path corresponding to the newly added configuration path and stores the newly added configuration file under the path.
In the embodiment, the application type of the application to be configured, the group of the application, the name of the application process, the name of the application instance, the project of the application and the deployment environment of the application are obtained; verifying the application type, the group where the application is located, the name of the application process, the name of the application instance, the project where the application is located and the application deployment environment; and when the verification is passed, generating application information according to the application type, the group where the application is located, the application process name, the application instance name, the project where the application is located and the application deployment environment. By the method, the detailed application information of the application to be configured is obtained, and the configuration file required by the application to be configured can be accurately positioned.
Referring to fig. 4, fig. 4 is a flowchart illustrating an application configuration method according to a third embodiment of the present invention.
Based on the first embodiment, in step S20, the configuration method applied in this embodiment includes:
step S21: and acquiring a configuration sequence file.
In this scheme, the configuration sequence file includes a macro variable configuration path that has been defined, and a sequence of loading configuration, and the macro variable includes:
PILOT _ TYPE: and the application type, client or service, distinguishes the client from background service.
PILOT _ GROUP: grouping, dividing a plurality of applications sharing the configuration into one group, and sharing the configuration.
PILOT _ PROCESS: the application process name defines the configuration under the application.
PILOT _ PROJECT: item, configuration unique to this item.
PILOT _ insert _ NAME: instance names, different configurations can be added for a given instance
PILOT _ ENV: the deployment environment, different environment needs different configuration, can also with other types of data sharing.
The macro variables correspond to the application types of the applications to be configured, the groups of the applications, the names of the application processes, the items of the applications, the names of the application instances and the application deployment environments one by one. The application TYPE corresponds to the PILOT _ TYPE, the GROUP where the application is located corresponds to the PILOT _ GROUP, the application PROCESS NAME corresponds to the PILOT _ PROCESS, the item where the application is located corresponds to the PILOT _ PROJECT, the application INSTANCE NAME corresponds to the PILOT _ INSTANCE _ NAME, and the application deployment environment corresponds to the PILOT _ ENV.
Step S22: and determining a macro variable path in the configuration sequence file.
In this embodiment, macro variable paths are stored in the configuration sequence file in a certain order, and the macro variable paths are configuration file paths including the macro variables. Examples of "configuration sequence file" content are as follows:
1.config/{PILOT_TYPE}/{PILOT_PROCESS}/{PILOT_PROJECT}/{PILOT_INSTANCE_NAME}/{PILOT_ENV}/env.prop
2.config/{PILOT_TYPE}/{PILOT_PROCESS}/{PILOT_PROJECT}/{PILOT_INSTANCE_NAME}/env.prop
3.config/{PILOT_TYPE}/{PILOT_PROCESS}/{PILOT_PROJECT}/{PILOT_ENV}/env.prop
4.config/{PILOT_TYPE}/{PILOT_PROCESS}/{PILOT_PROJECT}/env.prop
5.config/{PILOT_TYPE}/{PILOT_PROCESS}/{PILOT_INSTANCE_NAME}/env.prop
6.config/{PILOT_TYPE}/{PILOT_PROCESS}/{PILOT_ENV}/env.prop
7.config/{PILOT_TYPE}/{PILOT_PROCESS}/env.prop
8.config/{PILOT_TYPE}/{PILOT_GROUP}/{PILOT_PROJECT}/{PILOT_ENV}/env.prop
9.config/{PILOT_TYPE}/{PILOT_GROUP}/{PILOT_PROJECT}/env.prop
10.config/{PILOT_TYPE}/{PILOT_GROUP}/{PILOT_ENV}/env.prop
11.config/{PILOT_TYPE}/{PILOT_GROUP}/env.prop
12.config/{PILOT_TYPE}/common/{PILOT_PROJECT}/{PILOT_ENV}/env.prop
13.config/{PILOT_TYPE}/common/{PILOT_ENV}/env.prop
14.config/{PILOT_TYPE}/common/env.prop
15.config/common/{PILOT_GROUP}/{PILOT_PROJECT}/{PILOT_ENV}/env.prop
16.config/common/{PILOT_GROUP}/{PILOT_PROJECT}/env.prop
17.config/common/{PILOT_PROJECT}/env.prop
18.config/common/{PILOT_GROUP}/{PILOT_ENV}/env.prop
19.config/common/{PILOT_GROUP}/env.prop
20.config/common/{PILOT_ENV}/env.prop
21.config/common/env.prop
step S23: and determining the macro variable to be replaced in the macro variable path according to the application information.
In the specific implementation, the part needing to be replaced in the macro variable path, namely the macro variable to be replaced, is determined according to the corresponding relation between the application information and the macro variable.
Step S24: and generating a configuration file path according to the application information and the macro variable to be replaced.
And after determining the macro variables to be replaced, replacing the corresponding macro variables to be replaced with the application types, the groups where the applications are located, the names of the application processes, the projects where the applications are located, the names of the application instances and the application deployment environments in the application information, so as to generate a configuration file path.
An example of a configuration path after replacement is as follows:
1.config/service/process_a/project_a/1/dev/env.prop
2.config/service/process_a/project_a/1/env.prop
3.config/service/process_a/project_a/dev/env.prop
4.config/service/process_a/project_a/env.prop
5.config/service/process_a/1/env.prop
6.config/service/process_a/dev/env.prop
7.config/service/process_a/env.prop
8.config/service/group_a/project_a/dev/env.prop
9.config/service/group_a/project_a/env.prop
10.config/service/group_a/dev/env.prop
11.config/service/group_a/env.prop
12.config/service/common/project_a/dev/env.prop
13.config/service/common/dev/env.prop
14.config/service/common/env.prop
15.config/common/group_a/project_a/dev/env.prop
16.config/common/group_a/project_a/env.prop
17.config/common/project_a/env.prop
18.config/common/group_a/dev/env.prop
19.config/common/group_a/env.prop
20.config/common/dev/env.prop
21.config/common/env.prop
it should be noted that the configuration files to be loaded under different paths have different functions, for example: the profile "20. config/common/dev/env.prop" refers to a configuration shared by all dev environments, without distinguishing between clients or services. The configuration file "14. config/service/common/env. process" refers to a configuration common to all services, does not distinguish between environments, and the group configuration file "4. config/service/process _ a/project _ a/env. process" refers to a configuration unique to the application process _ a under the project _ a, and can share all environments as all application instances and their runs.
The configuration file "1. config/service/process _ a/project _ a/1/dev/env. p" refers to the specific configuration of the application with the application name of process _ a under the project _ a and the instance name of 1 under the dev environment, if the application runs under the dev, the configuration in the configuration file is always effective, and the same configuration under other paths cannot be adopted.
Step S25: and determining the loading sequence of the configuration files according to the preset path sequence in the configuration sequence files.
It can be understood that the macro variable paths in the configuration sequence file have a certain sequence, the sequence is a preset path sequence, and the preset path sequence is consistent with the loading sequence of the configuration file corresponding to the preset path sequence, so that the loading sequence of the configuration file can be obtained.
The embodiment obtains the configuration sequence file; determining a macro variable path in the configuration sequence file; determining a macro variable to be replaced in the macro variable path according to the application information; generating a configuration file path according to the application information and the macro variable to be replaced; and determining the loading sequence of the configuration files according to the preset path sequence in the configuration sequence files. Through the mode, the corresponding configuration file path is determined based on the configuration sequence file and the application information, so that the sharing of configuration among projects, groups, processes and deployment environments is realized.
Referring to fig. 5, fig. 5 is a flowchart illustrating an application configuration method according to a fourth embodiment of the present invention.
Based on the first embodiment, in step S30, the configuration method applied in this embodiment includes:
step S31: and sending the configuration file path to a configuration server so that the configuration server determines the path type of the configuration file path, when the path type is a merging path, determining the same configuration file according to the merging path, determining a different configuration file according to the configuration file path, generating a configuration file to be loaded according to the same configuration file and the different configuration file, and feeding back the configuration file to be loaded.
In a specific implementation, the configuration server traverses each configuration file path, and classifies similar paths (same item or same process) as the same type, for example: config/service/process _ a/project _ a/1/dev/env. process and config/service/process _ a/project _ a/2/dev/env. process can be classified into the same type. Comparing the configuration files in the same type, if the same configuration exceeds a threshold value, for example, the threshold value may be 80%, the configuration files may be regarded as similar configuration files, combining the same parts of the similar configuration files to obtain the same configuration files, separating the distinguished parts to obtain distinguished configuration files, and marking the distinguished parts with corresponding path labels of the configuration files. And merging the corresponding configuration paths. The configuration paths before merging all point to the configuration paths after merging.
It can be understood that, after receiving the configuration file path, the configuration server determines whether the configuration file path points to the merge path, and when the configuration file path points to the merge path, determines that the configuration file path is the merge path, and when the configuration file path is the merge path, obtains the same configuration file, determines the distinguished configuration file corresponding to the label based on the configuration file path, and merges the same configuration file and the distinguished configuration file to obtain the configuration file to be loaded.
Step S32: and determining a target configuration file according to the configuration file to be loaded.
Further, to avoid repeatedly loading the loaded configuration file, step S32 includes: acquiring a loaded configuration file of the application to be configured; comparing the configuration file to be loaded with the loaded configuration file to obtain a difference configuration file; and taking the difference configuration file as a target configuration file.
It can be understood that, since a user may load some configuration files for the application to be loaded, after obtaining the configuration files to be loaded, the loaded configuration files of the application to be loaded are obtained, and after comparing the configuration files to be loaded with the loaded configuration files, the configuration files that are not loaded, that is, the target configuration files, can be selected from the configuration files to be loaded; or when the files to be configured are loaded in sequence, if the files to be configured are loaded, skipping is omitted, and the next configuration file to be loaded is loaded.
In this embodiment, the configuration file path is sent to a configuration server, so that the configuration server determines a path type of the configuration file path, when the path type is a merged path, determines a same configuration file according to the merged path, determines a distinct configuration file according to the configuration file path, generates a configuration file to be loaded according to the same configuration file and the distinct configuration file, and feeds back the configuration file to be loaded; and determining a target configuration file according to the configuration file to be loaded. By the method, the storage resource consumption of the configuration server can be saved.
Furthermore, an embodiment of the present invention further provides a storage medium, where an application configuration program is stored on the storage medium, and the application configuration program, when executed by a processor, implements the steps of the application configuration method as described above.
Since the storage medium adopts all technical solutions of all the embodiments, at least all the beneficial effects brought by the technical solutions of the embodiments are achieved, and no further description is given here.
Referring to fig. 6, fig. 6 is a block diagram of a first embodiment of the application configuration apparatus according to the present invention.
As shown in fig. 6, an application configuration apparatus provided in an embodiment of the present invention includes:
the information obtaining module 10 is configured to obtain application information of an application to be configured when performing application configuration.
And a configuration determining module 20, configured to determine a configuration file path and a configuration file loading sequence according to the application information of the application to be configured.
And a file obtaining module 30, configured to obtain the target configuration file according to the configuration file path.
And a configuration loading module 40, configured to load the target configuration file according to the configuration file loading order.
In an embodiment, the information obtaining module 10 is further configured to obtain an application type of the application to be configured, a group in which the application is located, an application process name, an application instance name, a project in which the application is located, and an application deployment environment; verifying the application type, the group where the application is located, the name of the application process, the name of the application instance, the project where the application is located and the application deployment environment; and when the verification is passed, generating application information according to the application type, the group where the application is located, the application process name, the application instance name, the project where the application is located and the application deployment environment.
In an embodiment, the information obtaining module 10 is further configured to prompt the user to add the configuration file of the application to be configured when the verification fails, so as to obtain a new configuration file; adding the application type, the application group, the application process name, the application instance name, the application project, the application deployment environment and the newly added configuration path of the newly added configuration file; and sending the newly added configuration file and the newly added configuration path to a configuration server so that the configuration server creates the newly added configuration path and stores the newly added configuration file based on the newly added configuration path.
In an embodiment, the configuration determining module 20 is further configured to obtain a configuration sequence file; determining a macro variable path in the configuration sequence file; determining a macro variable to be replaced in the macro variable path according to the application information; generating a configuration file path according to the application information and the macro variable to be replaced; and determining the loading sequence of the configuration files according to the preset path sequence in the configuration sequence files.
In an embodiment, the file obtaining module 30 is further configured to send the configuration file path to a configuration server, so that the configuration server determines a path type of the configuration file path, determine the same configuration file according to the merged path when the path type is the merged path, determine a difference configuration file according to the configuration file path, generate a configuration file to be loaded according to the same configuration file and the difference configuration file, and feed back the configuration file to be loaded; and determining a target configuration file according to the configuration file to be loaded.
In an embodiment, the file obtaining module 30 is further configured to obtain a loaded configuration file of the application to be configured; comparing the configuration file to be loaded with the loaded configuration file to obtain a difference configuration file; and taking the difference configuration file as a target configuration file.
In an embodiment, the configuration loading module 40 is further configured to obtain a configured application after the target configuration file is loaded; detecting whether a configuration of the configured application is modified; when the configuration of the configured application is modified, generating a modified configuration file according to the modified configuration; determining a configuration file path corresponding to the modified configuration file; and sending the modified configuration file and the configuration file path to the configuration server so that the configuration server updates the configuration file corresponding to the configuration file path according to the modified configuration file.
It should be understood that the above is only an example, and the technical solution of the present invention is not limited in any way, and in a specific application, a person skilled in the art may set the technical solution as needed, and the present invention is not limited thereto.
In the embodiment, when application configuration is performed, application information of an application to be configured is acquired; determining a configuration file path and a configuration file loading sequence according to the application information of the application to be configured; acquiring a target configuration file according to the configuration file path; and loading the target configuration files according to the loading sequence of the configuration files. By the method, the path of the configuration file is determined according to the application information of the application to be configured, so that different applications to be configured can determine the specific path and the loading sequence of the configuration file, the corresponding configuration file is obtained according to the path of the configuration file, and the loading of the configuration file is completed according to the loading sequence of the configuration file, so that multiple applications to be configured with the same application information can obtain the same path and loading sequence of the configuration file, and the multiple applications to be configured can share the configuration.
It should be noted that the above-described work flows are only exemplary, and do not limit the scope of the present invention, and in practical applications, a person skilled in the art may select some or all of them to achieve the purpose of the solution of the embodiment according to actual needs, and the present invention is not limited herein.
In addition, the technical details that are not described in detail in this embodiment may refer to the application configuration method provided in any embodiment of the present invention, and are not described herein again.
Further, it is to be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system 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 system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention or portions thereof that contribute to the prior art may be embodied in the form of a software product, where the computer software product is stored in a storage medium (e.g. Read Only Memory (ROM)/RAM, magnetic disk, optical disk), and includes several instructions for enabling a terminal device (e.g. a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. An application configuration method, characterized in that the application configuration method comprises:
when application configuration is carried out, acquiring application information of an application to be configured;
determining a configuration file path and a configuration file loading sequence according to the application information of the application to be configured;
acquiring a target configuration file according to the configuration file path;
and loading the target configuration files according to the loading sequence of the configuration files.
2. The method of claim 1, wherein the obtaining application information of an application to be configured when performing application configuration comprises:
acquiring the application type of the application to be configured, the group of the application, the name of an application process, the name of an application instance, the project of the application and the deployment environment of the application;
verifying the application type, the group where the application is located, the name of the application process, the name of the application instance, the project where the application is located and the application deployment environment;
and when the verification is passed, generating application information according to the application type, the group where the application is located, the application process name, the application instance name, the project where the application is located and the application deployment environment.
3. The method of claim 2, wherein after verifying the application type, the grouping of applications, the application process name, the application instance name, the project of applications, and the application deployment environment, further comprising:
when the verification fails, prompting a user to add the configuration file of the application to be configured to obtain a newly added configuration file;
adding the application type, the application group, the application process name, the application instance name, the application project, the application deployment environment and the newly added configuration path of the newly added configuration file;
and sending the newly added configuration file and the newly added configuration path to a configuration server so that the configuration server creates the newly added configuration path and stores the newly added configuration file based on the newly added configuration path.
4. The method of claim 1, wherein the determining a configuration file path and a configuration file loading order according to the application information of the application to be configured comprises:
acquiring a configuration sequence file;
determining a macro variable path in the configuration sequence file;
determining a macro variable to be replaced in the macro variable path according to the application information;
generating a configuration file path according to the application information and the macro variable to be replaced;
and determining the loading sequence of the configuration files according to the preset path sequence in the configuration sequence files.
5. The method of claim 1, wherein said obtaining a target profile according to the profile path comprises:
sending the configuration file path to a configuration server so that the configuration server determines the path type of the configuration file path, when the path type is a merging path, determining the same configuration file according to the merging path, determining a distinguished configuration file according to the configuration file path, generating a configuration file to be loaded according to the same configuration file and the distinguished configuration file, and feeding back the configuration file to be loaded;
and determining a target configuration file according to the configuration file to be loaded.
6. The method of claim 5, wherein determining a target configuration file from the configuration file to be loaded comprises:
acquiring a loaded configuration file of the application to be configured;
comparing the configuration file to be loaded with the loaded configuration file to obtain a difference configuration file;
and taking the difference configuration file as a target configuration file.
7. The method of any of claims 1 to 6, wherein after loading the target configuration file in the configuration file loading order, further comprising:
when the target configuration file is loaded, obtaining configured application;
detecting whether a configuration of the configured application is modified;
when the configuration of the configured application is modified, generating a modified configuration file according to the modified configuration;
determining a configuration file path corresponding to the modified configuration file;
and sending the modified configuration file and the configuration file path to the configuration server so that the configuration server updates the configuration file corresponding to the configuration file path according to the modified configuration file.
8. An application configuration apparatus, characterized in that the application configuration apparatus comprises:
the information acquisition module is used for acquiring application information of an application to be configured when application configuration is carried out;
the configuration determining module is used for determining a configuration file path and a configuration file loading sequence according to the application information of the application to be configured;
the file acquisition module is used for acquiring a target configuration file according to the configuration file path;
and the configuration loading module is used for loading the target configuration file according to the loading sequence of the configuration file.
9. An application configuration device, characterized in that the device comprises: a memory, a processor, and an application configuration program stored on the memory and executable on the processor, the application configuration program configured to implement the application configuration method of any of claims 1 to 7.
10. A storage medium having stored thereon an application configuration program which, when executed by a processor, implements the application configuration method of any one of claims 1 to 7.
CN202111558253.7A 2021-12-17 2021-12-17 Application configuration method, device, equipment and storage medium Pending CN114237633A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111558253.7A CN114237633A (en) 2021-12-17 2021-12-17 Application configuration method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111558253.7A CN114237633A (en) 2021-12-17 2021-12-17 Application configuration method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114237633A true CN114237633A (en) 2022-03-25

Family

ID=80758806

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111558253.7A Pending CN114237633A (en) 2021-12-17 2021-12-17 Application configuration method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114237633A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114995877A (en) * 2022-08-03 2022-09-02 平安银行股份有限公司 Variable configuration method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114995877A (en) * 2022-08-03 2022-09-02 平安银行股份有限公司 Variable configuration method and device
CN114995877B (en) * 2022-08-03 2022-10-28 平安银行股份有限公司 Variable configuration method and device

Similar Documents

Publication Publication Date Title
AU2016359508B2 (en) Page jumping method and apparatus
CN112486547B (en) Application program updating method and device under multi-tenant scene and electronic equipment
US20160132314A1 (en) Remote configuration management of applications
CN108235763B (en) Detection system, method and related device
CN110569035A (en) Code compiling method, device, equipment and storage medium of software development project
WO2022252510A1 (en) Resource management method, apparatus and device
CN113330419A (en) Equipment application installation method and device
CN111399860B (en) Light application deployment method, light application deployment device, computer equipment and storage medium
CN117693734A (en) Front-end item processing method, device, equipment, management system and storage medium
CN114237633A (en) Application configuration method, device, equipment and storage medium
CN113419818B (en) Basic component deployment method, device, server and storage medium
CN110737458A (en) code updating method and related device
CN114003432A (en) Parameter checking method and device, computer equipment and storage medium
CN115729590A (en) Service deployment method, device, equipment and computer readable storage medium
CN112364340B (en) Authority management method, device, equipment and computer readable storage medium
CN112685613B (en) Resource package query method and device and information processing system
CN114385192A (en) Application deployment method and device, computer equipment and storage medium
CN114443215A (en) Service application deployment method and device, computer equipment and storage medium
CN114237736A (en) Page resource loading method, system, device, computer equipment and storage medium
CN113672281A (en) Code difference query method, device, equipment and storage medium
US8065671B1 (en) Systems and methods for product updates with provisioning of data items
CN111552571B (en) Application feedback method, computer device and computer storage medium
CN112650509B (en) Application installation package generation method and device, computer equipment and storage medium
CN115904557A (en) Browser status bar control method, device, equipment and storage medium
CN114254027A (en) Data processing method, device, equipment and storage medium

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