Method and device for determining application configuration information
By using a predetermined placeholder in the application configuration information and replacing it after receiving the target parameter value, the problems of complex configuration file history and difficulty in application management in the prior art are solved, and simplified application version management and accurate configuration information acquisition are achieved.
Patent Information
- Application Number
- CN202411941743.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-12-26
AI Technical Summary
In the prior art, the variable values of environment variables in the configuration file are directly replaced, resulting in complex configuration file history and increasing the difficulty of application management.
By receiving the application configuration request, the basic configuration information corresponding to the application identifier is determined, including predetermined placeholders, and the target parameter value is used to replace these placeholders to obtain the target configuration information in the target application environment.
Reduces the number of files that record configuration information updates, simplifies application version management, and solves the problems of complex configuration file history and difficulty in application management.
Smart Images

Figure CN119883407A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing, and in particular to a method and device for determining application configuration information. Background Art
[0002] The configuration information of an application has specific configuration parameter values in different deployment environments. Configuring different configuration information for different deployment environments is the basis for ensuring that the application can run normally in the corresponding environment. At present, the method adopted is to configure the corresponding configuration file for each environment and manually replace the environment variable values in the configuration file. However, this method will cause the content of the configuration file to change, increase the complexity of the configuration process version record file, and increase the difficulty of application version management.
[0003] In the related art, directly replacing the variable values of environment variables in the configuration file leads to complex configuration file history records and increased difficulty in application management. No effective solution has been proposed yet. Summary of the invention
[0004] The main purpose of the present application is to provide a method and device for determining application configuration information to solve the problem in the related art of directly replacing the variable values of environment variables in the configuration file, which leads to complex configuration file history records and increased difficulty in application management.
[0005] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a method for determining application configuration information is provided. The method comprises: receiving an application configuration request, wherein the application configuration request carries an application identifier of a target application and an environment identifier corresponding to a target application environment; in response to the application configuration request, determining basic configuration information corresponding to the application identifier, wherein the basic configuration information includes a predetermined placeholder, and the predetermined placeholder is a placeholder to be replaced, and is to be replaced with a target parameter value under the target application environment; determining a target parameter value corresponding to the environment identifier; using the target parameter value to replace the predetermined placeholder in the basic configuration information, and obtaining the target configuration information under the target application environment.
[0006] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a device for determining application configuration information is provided. The device includes: a receiving module, which is used to receive an application configuration request, wherein the application configuration request carries an application identifier of a target application and an environment identifier corresponding to a target application environment; a first determining module, which is used to determine the basic configuration information corresponding to the application identifier in response to the application configuration request, wherein the basic configuration information includes a predetermined placeholder, and the predetermined placeholder is a placeholder to be replaced, and is to be replaced with a target parameter value under the target application environment; a second determining module, which is used to determine the target parameter value corresponding to the environment identifier; a first replacing module, which is used to replace the predetermined placeholder in the basic configuration information with the target parameter value to obtain the target configuration information under the target application environment.
[0007] In an embodiment of the present application, an application configuration request is received, wherein the application configuration request carries an application identifier of a target application and an environment identifier corresponding to a target application environment; in response to the application configuration request, basic configuration information corresponding to the application identifier is determined, wherein the basic configuration information includes a predetermined placeholder, which is a placeholder to be replaced, and is to be replaced with a target parameter value in the target application environment; the target parameter value corresponding to the environment identifier is determined; the target parameter value is used to replace the predetermined placeholder in the basic configuration information, and the target configuration information in the target application environment is obtained. By using the target parameter value to replace the predetermined placeholder in the basic configuration information, the purpose of obtaining the target configuration information in the target application environment is achieved. Since the predetermined placeholder is used in the basic configuration information to replace the specific environment variable value in different deployment environments, after obtaining the target parameter value, the predetermined placeholder in the basic configuration information can be directly replaced to obtain the target configuration information. By determining the target configuration information in this way, the number of files recording configuration information updates can be reduced, the application version management is simplified, and the problem of directly replacing the variable value of the environment variable in the configuration file in the related art, resulting in complex configuration file history records and increased application management difficulties, is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0009] Figure 1 It is a hardware structure block diagram of a computer terminal for implementing a method for determining application configuration information according to an embodiment of the present application;
[0010] Figure 2 is a flowchart of a method for determining application configuration information provided in an embodiment of the present application;
[0011] Figure 3 is a schematic diagram of a device for determining application configuration information provided in an embodiment of the present application;
[0012] Figure 4 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0013] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0014] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0015] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following explanations:
[0016] YAML: is a highly readable format used to express data serialization.
[0017] Patch: A differential update method used to modify existing files or configurations. In the context of container orchestration tools, it is mainly used to fine-tune or overwrite the basic configuration for a specific environment or requirement when deploying an application. It is usually a YAML file that contains modification instructions for the original configuration. It can be used to add, modify, or delete fields in the existing configuration to make it meet specific environment or deployment requirements.
[0018] ConfigMap: It is a basic resource object in the container orchestration platform, which is used to store non-confidential configuration data. In the context of the container orchestration platform, configuration data can include various application parameters, environment variables, command line parameters, and any other non-sensitive settings. ConfigMap provides a mechanism to inject configuration information into the container without modifying the application code or image.
[0019] params directory: specifically refers to the directory used to manage the configuration of container orchestration platform applications. In the file directory structure of container orchestration tools, the params directory is often used to centrally manage variable parameters so that the configuration can be adjusted quickly and accurately when the same application is deployed in different environments.
[0020] The base directory is the root directory of the configuration files. It contains the container orchestration platform resource definitions and variable definitions that are common to all environments. When using container orchestration tools, start from the base directory and apply various overrides to suit the specific environment.
[0021] Overlay directory: A dedicated directory for storing configuration overrides for specific environments or scenarios. It allows users to customize and adjust configuration parameters for different environments (such as development, testing, and production environments) or different deployment scenarios while keeping the basic configuration unchanged.
[0022] variables directory: Mainly responsible for storing and managing all configuration-related variables. In container orchestration platform deployment, variables usually refer to values that may need to be changed in different environments or deployment contexts, such as database connection strings, service ports, environment identifiers, etc. The configuration files under the variables directory allow you to define the names and default values of these variables, as well as how they are referenced by other configuration files.
[0023] Resources directory: Contains the actual resource definition files in the container orchestration platform cluster. These files describe the specific configuration of services and resources required for application runtime, including container images, port mappings, environment variable settings, etc.
[0024] application.properties file: is a configuration file format commonly used in programming language applications. It is a simple key-value pair configuration file that uses the format of a property file to store configuration parameters. Each configuration item consists of a key and a value, and the key and value are separated by an equal sign (=) or a colon (:).
[0025] It should be noted that the collected information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this application are information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with relevant laws, regulations and standards, necessary confidentiality measures are taken, and public order and good customs are not violated, and corresponding operation entrances are provided for users to choose to authorize or refuse. For example, an interface is set up between this system and relevant users or institutions to provide users with corresponding operation entrances for users to choose to agree or refuse the results of automated decision-making; if the user chooses to refuse, the expert decision-making process will be entered.
[0026] Example 1
[0027] According to an embodiment of the present application, an embodiment of a method for determining application configuration information is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0028] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 is a hardware structure block diagram of a computer terminal for implementing a method for determining application configuration information according to an embodiment of the present application, such as Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0029] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0030] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the method for determining application configuration information in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the method for determining the application configuration information described above is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0031] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0032] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0033] In the above operating environment, the present application provides a method for determining application configuration information. Figure 2 is a flowchart of a method for determining application configuration information provided in an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0034] Step S202: receiving an application configuration request, wherein the application configuration request carries an application identifier of a target application and an environment identifier corresponding to a target application environment.
[0035] In step S202 provided in the present application, an application configuration request carrying an application identifier of a target application and an environment identifier corresponding to a target application environment is received.
[0036] Among them, application configuration requests are involved. Application configuration requests refer to requests from users to change, update or obtain configuration information of a specific application. Such requests are usually initiated when the application is deployed, upgraded or switched to another environment to ensure that the application can correctly adapt to its operating environment.
[0037] Among them, the target application is involved, and the target application refers to a specific software application that needs to adapt to the operating requirements of different environments by changing the defined configuration parameters.
[0038] Among them, the application identifier is involved. The application identifier refers to the identifier used to determine the target application, such as the application name, label or namespace, etc., which can help identify and process the request of the target application.
[0039] Among them, the target application environment is involved. The target application environment refers to the specific environment or stage in which the target application runs. During the life cycle of software development and deployment, the application will go through multiple different environments, each with its own specific purpose and configuration requirements, such as development environment (dev), test environment (test), pre-production environment (staging) and production environment (prod).
[0040] Among them, the environment identifier is involved. The environment identifier refers to the identifier used to distinguish different operating environments of the target application. The environment identifier is crucial in configuration management and determines which configuration parameters should be loaded or modified.
[0041] In this step, an application configuration request is received, which contains two key pieces of information: application identification and environment identification. These two pieces of information are used to locate and process the correct application configuration. Through the environment identification, the environment that the application currently needs to be configured can be identified, and independent and customized configuration information can be provided for each environment, which enhances the stability and security of the application.
[0042] Step S204, in response to the application configuration request, determining basic configuration information corresponding to the application identifier, wherein the basic configuration information includes a predetermined placeholder, and the predetermined placeholder is a placeholder to be replaced, and is to be replaced by a target parameter value in the target application environment.
[0043] In step S204 provided in the present application, in response to the application configuration request, basic configuration information corresponding to the application identifier is determined.
[0044] Among them, basic configuration information is involved. Basic configuration information refers to configuration information that is generally applicable to the application during its life cycle, regardless of the environment it runs in. This information contains the basic settings and parameters of the application, but some of these parameters need to be adjusted according to different operating environments. These parameters are replaced by predetermined placeholders in the basic information.
[0045] Among them, it involves predetermined placeholders, which refer to special marks or symbols that are pre-set in the basic configuration information and are waiting to be replaced by specific parameter values in a specific environment configuration.
[0046] Among them, the target parameter value is involved, and the target parameter value refers to the parameter value actually required by the configuration information of the target application in the target application environment.
[0047] In this step, by identifying the application identifier in the application configuration request, the corresponding basic configuration information is located and obtained. The basic configuration information includes a predetermined placeholder, which represents the environment parameter value to be replaced in the target application environment.
[0048] By using placeholders in the basic configuration information in this step, you can ensure that the basic configuration information itself is independent of the environment, thereby simplifying configuration management, avoiding the complexity and redundancy of maintaining separate configuration files for each environment, and facilitating version control and auditing of application configurations. At the same time, the standardized design of basic configuration information makes configuration maintenance and application expansion easier. When adding or deleting new environment variables, you can complete it by modifying the basic configuration information.
[0049] Step S206, determining a target parameter value corresponding to the environment identifier.
[0050] In step S206 provided in the present application, a target parameter value corresponding to the environment identifier is determined.
[0051] In this step, the environment-specific parameter values are searched and determined based on the environment identifier provided in the application configuration request. Each environment identifier corresponds to a specific set of parameter values, ensuring that when switching between different environments, the application can obtain the configuration information corresponding to the environment identifier, reducing operational problems caused by configuration errors.
[0052] Through this step, the target parameter value corresponding to the environment identifier is determined. The target parameter value usually contains sensitive information bound to the environment identifier. After receiving the application configuration request, the target parameter value corresponding to the environment identifier is determined, which can achieve more secure parameter management and avoid sensitive information from being exposed or misused in an inappropriate environment. At the same time, by determining the target parameter value corresponding to the environment identifier, a customized configuration can be provided for each environment to ensure the correct operation and optimal performance of the application in different environments. In addition, whether adding a new environment or modifying an existing parameter value, it can be achieved by modifying the parameter value of the corresponding environment without modifying the configuration content and basic configuration information of other environments, making the management and maintenance of application configuration simpler and more efficient.
[0053] It should be noted that the process of determining target parameter values also involves version control and auditing. The target parameter values under each environment identifier can be version controlled to track historical changes, which is particularly important for complex application deployment and rollback scenarios. In addition, in industries such as fintech, healthcare, and telecommunications, applications need to run in a highly secure and regulated environment. Determining the target parameter values corresponding to the environment identifier must not only ensure that the application adapts to the functional requirements of different environments, but also meet industry-specific security and compliance requirements. For example, ensuring that the database connection parameters of the production environment are the latest and most secure, and completely isolated from the parameters of the development environment, avoids the leakage of production data and the potential impact of development operations on the production environment.
[0054] Step S208: Use the target parameter value to replace the predetermined placeholder in the basic configuration information to obtain the target configuration information in the target application environment.
[0055] In step S208 provided in the present application, the target parameter value is used to replace the predetermined placeholder in the basic configuration information to obtain the target configuration information in the target application environment.
[0056] Among them, the target configuration information is involved. The target configuration information refers to the final configuration information obtained after the target application is deployed to the target application environment and the predetermined placeholders in the basic configuration information are replaced with the target parameter values. These configuration information contain all the necessary parameter values of the target application environment and are applicable to the operation requirements of the current target application environment.
[0057] In this step, after reading the target parameter value associated with the environment identifier, all predetermined placeholders are found in the basic configuration information and replaced with the read target parameter value, thereby generating final configuration information adapted to the target application environment, namely, the target configuration information.
[0058] Through this step, the placeholders in the basic configuration information are replaced with the target parameter values, which can ensure that the configuration information in each environment is accurate and applicable, and avoid application operation problems caused by configuration not adapting to the environment.
[0059] It should be noted that in actual deployment, it can be closely integrated with the continuous integration / continuous deployment (CI / CD) process to ensure that each deployment uses the latest and correct environment configuration. For example, when a microservice is transferred from the development environment to the production environment, the CI / CD system will automatically detect the change in the environment, and then read the database connection information and other parameters of the production environment, inject these target parameter values into the basic configuration information, replace the corresponding placeholders, and generate the final production environment configuration file. This process not only improves the degree of automation of deployment, but also ensures the stability and security of the application in the production environment, and avoids failures or security vulnerabilities caused by improper configuration.
[0060] The method for determining application configuration information provided by the embodiment of the present application receives an application configuration request, wherein the application configuration request carries an application identifier of a target application and an environment identifier corresponding to a target application environment; in response to the application configuration request, determines basic configuration information corresponding to the application identifier, wherein the basic configuration information includes a predetermined placeholder, and the predetermined placeholder is a placeholder to be replaced, and is to be replaced with a target parameter value in the target application environment; determines the target parameter value corresponding to the environment identifier; uses the target parameter value to replace the predetermined placeholder in the basic configuration information, and obtains the target configuration information in the target application environment. By using the target parameter value to replace the predetermined placeholder in the basic configuration information, the purpose of obtaining the target configuration information in the target application environment is achieved. Since the predetermined placeholder is used in the basic configuration information to replace the specific environment variable value in different deployment environments, after obtaining the target parameter value, the predetermined placeholder in the basic configuration information can be directly replaced to obtain the target configuration information. By determining the target configuration information in this way, the number of files recording configuration information updates can be reduced, and application version management can be simplified. This solves the problem in related technologies of directly replacing the variable values of environment variables in the configuration file, which leads to complex configuration file history records and increased difficulty in application management. This achieves the effect of being able to obtain accurate configuration information when the application switches between different environments, making application expansion and configuration maintenance easier.
[0061] Optionally, in the method for determining application configuration information provided in an embodiment of the present application, in response to an application configuration request, a method for determining basic configuration information corresponding to an application identifier includes: determining a basic configuration directory corresponding to a target application based on the application identifier, wherein the basic configuration directory includes a first file path corresponding to multiple basic configuration files; based on the multiple first file paths, retrieving multiple basic configuration files, wherein the multiple basic configuration files respectively include partial configuration information corresponding to the application identifier; and determining the basic configuration information based on the multiple partial configuration information.
[0062] In this embodiment, specific steps of determining basic configuration information corresponding to an application identifier in response to an application configuration request are described.
[0063] Among them, the basic configuration directory is involved. The basic configuration directory refers to the directory that stores the basic configuration information of the application. The basic configuration directory provides a unified configuration management entry point for the application.
[0064] Among them, the basic configuration files are involved. The basic configuration files refer to files that contain the basic configuration information required for the application to run. The configuration information of these files contains placeholders so that when deployed in a specific environment, they can be dynamically filled or adjusted according to the characteristics of the environment to adapt to different operating environments, such as development, testing, and production environments.
[0065] Among them, the first file path is involved, and the first file path refers to the path pointing to the basic configuration file in the basic configuration directory.
[0066] Among them, some configuration information is involved. Some configuration information refers to a part of the application configuration information stored in each basic configuration file in the basic configuration directory. This information may cover database connections, log levels, environment variables, etc., but each basic configuration file usually only involves one aspect of the configuration.
[0067] In this step, first, based on the application identifier in the received application configuration request, a specific directory storing basic configuration information, namely the basic configuration directory, is found. The directory contains multiple first file paths, which point to different configuration files containing partial configuration information of the application, namely multiple basic configuration files. Subsequently, all relevant basic configuration files are called from the basic configuration directory based on these first file paths. Each basic configuration file carries a part of the application configuration, such as database settings or log levels. Finally, these scattered partial configuration information are merged to construct a complete basic configuration information, which is the universal configuration basis for the application to run in any environment.
[0068] Through this step, some configuration information scattered in multiple basic configuration files is merged to build a complete basic configuration information, realizing modularization and detailed management of configuration. By sharing basic configuration information, in multi-environment scenarios, the resource requirements for storage and management are reduced, and the reuse rate of basic configuration information is improved. At the same time, the unified basic configuration directory ensures the centralized manageability and consistency of configuration information.
[0069] Optionally, in the method for determining application configuration information provided in an embodiment of the present application, before determining the basic configuration directory corresponding to the target application based on the application identifier, it also includes: creating a basic configuration management file under the basic configuration directory; and creating a first file path corresponding to multiple basic configuration files in the basic configuration management file.
[0070] In this embodiment, specific steps for creating a basic configuration management file are described.
[0071] Among them, the basic configuration management file is involved. The basic configuration management file refers to the file created in the basic configuration directory, which is used to organize and manage the basic configuration files containing configuration information in the directory. The basic configuration management file defines which basic configuration files to include when building basic configuration information, how to replace variables, and how to inherit configurations from other environments.
[0072] In this step, first, a basic configuration management file needs to be created in the basic configuration directory. This file will serve as an index and manager of the basic configuration files, and is used to define and control how to process and combine the various basic configuration files in the directory. Subsequently, in this basic configuration management file, first file paths corresponding to multiple basic configuration files are created. These paths will be used to call and integrate information in different basic configuration files to build a complete basic configuration information set.
[0073] Through this step, a basic configuration management file is created, which makes the organization and management of basic configuration information orderly, helps maintain the clarity and readability of the configuration, and facilitates the development and operation teams to understand and maintain it. By defining the first file path in the basic configuration management file, all relevant basic configuration files can be automatically identified and integrated, avoiding the tedious manual integration of configurations, while also reducing configuration deviations and omissions. At the same time, the basic configuration management file serves as the entry point for configuration information. By strictly controlling file references and parameter placeholder replacements, it can ensure that all configurations comply with established security policies and compliance requirements, reducing application failures caused by configuration errors.
[0074] Optionally, in the method for determining application configuration information provided in an embodiment of the present application, the method for determining the target parameter value corresponding to the environment identifier includes: determining an environment directory corresponding to the target application environment based on the environment identifier, wherein the environment directory includes a parameter management file; and determining the target parameter value corresponding to the environment identifier based on the parameter management file.
[0075] In this embodiment, specific steps of determining a target parameter value corresponding to an environment identifier are described.
[0076] Among them, the environment directory is involved. The environment directory refers to a folder associated with a specific environment identifier, which contains configuration parameters that are unique to the environment or need to be overridden. The environment directory makes the management and maintenance of environment-specific configurations simpler and more orderly.
[0077] Among them, the parameter management file is involved. The parameter management file refers to the file located in the environment directory and used to manage the file that records the actual parameter values in the environment. The parameter management file contains the override rules for specific environment parameters, the path of additional configuration files that need to be referenced, etc.
[0078] In this step, first, the system finds the environment directory related to the target application environment through the environment identifier. The environment directory is a folder containing all the unique configuration parameters in the environment. Then, in the environment directory, the parameter management file is found, and finally, according to the definition in the parameter management file, the target parameter value corresponding to the environment identifier is determined.
[0079] Through this step, the environment identifier and environment directory are used to determine the parameter management file. Based on the parameter management file, the target parameters corresponding to the target application environment are determined. This allows the application to dynamically adjust its configuration parameters when deployed to different environments to adapt to the specific needs of each environment without modifying the application code or basic configuration information, thereby improving the flexibility of configuration and the adaptability of the environment.
[0080] Optionally, in the method for determining application configuration information provided in the embodiment of the present application, a method for determining a target parameter value corresponding to an environment identifier according to a parameter management file includes: when a plurality of predetermined placeholders are included and a plurality of target parameter values are included, determining a modified placeholder and a default placeholder from the plurality of predetermined placeholders, wherein the modified placeholder is a placeholder for using a modified value after modifying the default parameter value at the corresponding placeholder position, and the default placeholder is a placeholder for using the default parameter value at the corresponding placeholder position; determining a parameter definition file and a target parameter file according to the parameter management file, wherein the parameter definition file includes the plurality of predetermined placeholders, The target parameter items respectively corresponding to the predetermined placeholders and the default parameter values respectively corresponding to the multiple target parameter items are determined, the target parameter file includes multiple modification parameter items corresponding to the environment identifiers and the modification parameter values respectively corresponding to the multiple modification parameter items, and the multiple target parameter items include multiple modification parameter items; according to the parameter definition file, the default parameter value corresponding to the default placeholder is determined, and according to the target parameter file, the modification parameter value corresponding to the modification placeholder is determined; according to the default parameter values respectively corresponding to the default placeholders and the modification parameter value corresponding to the modification placeholder, the target parameter values respectively corresponding to the multiple predetermined placeholders are determined.
[0081] In this embodiment, specific steps of determining a target parameter value corresponding to an environment identifier according to a parameter management file are described.
[0082] Among them, it involves modifying placeholders. Modifying placeholders refers to some placeholders in the predetermined placeholders. In the target application environment, the target parameter items corresponding to these placeholders need to replace the default values with the actual values of the environment.
[0083] Among them, default placeholders are involved. Default placeholders refer to some placeholders in the predetermined placeholders. In the target application environment, the target parameter items corresponding to these placeholders do not need to change the default values.
[0084] Among them, the default parameter value is involved. The default parameter value refers to the initial value of the parameter defined for the target parameter item corresponding to the predetermined placeholder in the basic configuration information, which is usually used when there is no specific environment coverage. These values provide a configuration baseline to ensure that the application has a basic running configuration in any environment.
[0085] Among them, a parameter definition file is involved. The parameter definition file refers to a file in the basic configuration directory that defines target parameter items corresponding to all predetermined placeholders and their default parameter values.
[0086] Among them, the target parameter file is involved. The target parameter file refers to a file in the environment directory that contains parameter modification values corresponding to the environment identifier.
[0087] Among them, target parameter items are involved. Target parameter items refer to configuration parameters that are expected to be replaced by specific environment values when deploying and running applications. These parameters are usually represented by predetermined placeholders in the basic configuration file, and they may have different values in different environments (such as development, testing, and production). The purpose of the design of target parameter items is to improve the flexibility and environmental adaptability of configuration, and ensure that the application can run correctly in different environments.
[0088] Among them, it involves modifying parameter items, which means that there are target parameter items with modified parameter values in the environment-specific configuration file, that is, the parameter definition file. These parameter items have default values in the parameter definition file, but in a specific environment, such as a production environment, they need to be adjusted to more specific or safer values to meet the needs of the specific environment.
[0089] Among them, it involves modification parameter values, which refer to specific values corresponding to the modification parameter items. These values are used in a specific environment corresponding to the environment identifier to replace the environment-specific parameter values of some predetermined placeholders (i.e., modification placeholders) in the basic configuration file.
[0090] In this step, first, the parameter definition file and the target parameter file are determined based on the parameter management file. The parameter definition file includes all target parameter items corresponding to the predetermined placeholders and their default values, i.e., default parameter values. The target parameter file contains the modified parameter items that need to be overwritten or modified in the target parameter items in the specific environment corresponding to the environment representation and their corresponding modified parameter values. Afterwards, all default parameter values are obtained from the parameter definition file, and at the same time, the modified parameter values in the specific environment are read from the target parameter file. If the value of a parameter is not specified in the target parameter file, the system will use the default value of the parameter. Finally, the default parameter value obtained from the parameter definition file is combined with the modified parameter value in the target parameter file to generate the final target parameter value set.
[0091] Through this step, parameter definitions and default values are centrally managed, reducing the workload of maintaining configurations in multiple environments and improving configuration efficiency and consistency. At the same time, environment-specific parameter values are stored in independent target parameter files rather than hard-coded in the basic configuration information, increasing configuration security and protecting sensitive information. When parameters need to be updated, only the parameter definition file or the target parameter file for a specific environment needs to be modified, without modifying the basic configuration information or the configuration files for each environment, simplifying the configuration update process.
[0092] Optionally, in the method for determining application configuration information provided in an embodiment of the present application, a parameter definition file and a target parameter file are determined based on a parameter management file, including: determining a reference identifier corresponding to the parameter management file; determining a parameter definition management file corresponding to the reference identifier, wherein the parameter definition management file includes a second file path corresponding to the parameter definition file; determining a third file path corresponding to the target parameter file based on the parameter management file; calling the parameter definition file based on the second file path, and calling the target parameter file based on the third file path.
[0093] In this embodiment, specific steps of determining a parameter definition file and a target parameter file based on a parameter management file are described.
[0094] Among them, reference identifiers are involved. Reference identifiers refer to labels or keywords used in parameter management files to reference other related files.
[0095] Among them, the parameter definition management file is involved. The parameter definition management file refers to the file located in the basic configuration directory and is used to manage the references of the parameter definition file.
[0096] Among them, the second file path is involved, and the second file path refers to the path pointing to the parameter definition file recorded in the parameter definition management file.
[0097] Among them, the third file path is involved, and the third file path refers to the path pointing to the target parameter file recorded in the parameter management file.
[0098] In this step, first, according to the parameter management file in the environment directory, the reference identifier is searched, and the reference identifier indicates the location of the parameter definition management file. After that, the parameter definition management file is located and parsed, and the parameter definition file is found through the second file path therein. These files define all target parameter items, including their default values. At the same time, the target parameter file is located through the third file path in the parameter management file. The target parameter file contains the override and modification values of the parameters for a specific environment. Finally, the parameter definition file is called according to the second file path, and the target parameter file is called according to the third file path.
[0099] Through this step, the parameter configuration is divided into two parts: parameter definition and parameter coverage, which realizes the modularization of configuration. The parameter definition file ensures the standardized management of environment-independent configuration. Through the target parameter file, each environment is allowed to set its own parameter value, so that the application can flexibly adapt to the characteristics of different environments, improving the environmental adaptability and deployability of the application. The separation of parameter definition files and target parameter files makes configuration auditing and version control more intuitive and orderly. At the same time, the unified reference and coverage of parameter management files simplifies the process of parameter update.
[0100] Optionally, in the method for determining application configuration information provided in an embodiment of the present application, a target parameter value is used to replace a predetermined placeholder in the basic configuration information to obtain a target configuration information method under a target application environment, including: determining a predetermined placeholder based on the basic configuration information; using the target parameter value to replace the predetermined placeholder to obtain updated configuration information; checking the updated configuration information to determine whether the updated configuration information includes the predetermined placeholder to obtain a determination result; when the determination result is that the updated configuration information does not include the predetermined placeholder, determining the target configuration information under the target application environment.
[0101] In this embodiment, the specific steps of using target parameter values to replace predetermined placeholders in basic configuration information to obtain target configuration information in a target application environment are described.
[0102] Among them, it involves updating configuration information. The updated configuration information refers to the configuration information version generated after replacing the predetermined placeholders in the basic configuration information with the target parameter values. It contains the actual configuration values in a specific environment.
[0103] The determination result is referred to as the result of determining whether there is a predetermined placeholder that has not been replaced in the update configuration information during the process of checking the update configuration information. For example, if there is no placeholder in the update configuration information, the determination result is "the update configuration information does not include the predetermined placeholder".
[0104] In this step, first, the basic configuration information is parsed, and the positions and names of all predetermined placeholders are searched and determined. Then, the predetermined placeholders determined above are replaced with the target parameter values. After the parameter value replacement is completed, the update configuration information is checked to ensure that all predetermined placeholders are replaced with actual parameter values and there are no unprocessed placeholders. Only when it is determined during the inspection process that the update configuration information no longer contains any predetermined placeholders, this version of the update configuration information will be officially determined as the target configuration information used in the target application environment for the final application deployment.
[0105] This step ensures that all the predetermined placeholders in the basic configuration information are successfully replaced by the target parameter values, and the application can be successfully applied in the target application environment, thereby improving the security and stability of the target configuration information configuration process.
[0106] Based on the above embodiments and optional embodiments, an optional implementation is provided, which is described in detail below.
[0107] In an optional implementation of the present invention, it involves configuring variable definition, variable reference, and variable modification (patch operation) in different file directories. The following is the setting code for different file directories.
[0108]
[0109]
[0110]
[0111] The params directory consists of two parts: the basic configuration directory (base directory) and the overlays directory. Contents not related to the environment are placed in the base directory, and contents related to the environment are placed in the overlays directory. The base directory contains a variables directory and several resources directories. The overlays directory contains several environment directories, such as the development environment (dev), production environment (prod), etc.
[0112] The following is a detailed description of the steps of a method for determining application information configuration provided in an optional implementation manner of the present invention.
[0113] Before configuring application information, you need to define the basic configuration information and target parameter values involved in the application configuration. The specific steps are as follows.
[0114] S1. Determine the parameter definition file.
[0115] Create a parameter definition file in the base directory, which includes all target variable items corresponding to the predetermined placeholders and their corresponding default values. At the same time, create a parameter definition management file in the base directory to organize and manage the parameter definition file.
[0116] A1. Create a parameter definition file.
[0117] Create a parameter definition file (variable-list.ConfigMap.yaml file) in / params / base / variables / . The file defines the default values of all variables of the application. In the data field of the file, key is the name of the variable and value is the default value of the variable. The following is the specific program code for defining variables.
[0118]
[0119] The variable ENV_DATABASE_URL is defined in the file content, and its default value is "this is databaseurl!".
[0120] Define a configuration file (var-references.yaml file) under / params / base / variables. The file configures the container orchestration tool. The following is the specific code for the configuration operation.
[0121] varReference:
[0122] -kind:ConfigMap
[0123] path:data
[0124] The container orchestration tool will perform variable value lookup operations based on this.
[0125] A2. Create a parameter definition management file.
[0126] Define the parameter definition management file under / params / base / variables. This file is responsible for managing the variable-list.ConfigMap.yaml file defined in the first step and references the defined configuration information. In addition, the file defines "app.<app name> .” format, which can be inherited by other management files.
[0127] The following is the specific code content in the parameter definition management file.
[0128] kind:"Kustomization"
[0129] namePrefix:app.my-app-name.
[0130] resources:
[0131] variable-list.ConfigHap.yaml
[0132] configurations:
[0133] var-references.yaml
[0134] vars:
[0135] name:ENV_DATABASE_URL
[0136] objref:
[0137] kind:ConfigMap
[0138] nane:variable-list
[0139] apiVersion:v1
[0140] fieldref:
[0141] fieldPath:data.ENV_DATABASE_URL
[0142] S2. Create a basic configuration file.
[0143] Create multiple basic configuration files in the base directory, and replace the environment-related variable parameters with placeholders to form a basic configuration information template suitable for different environments. At the same time, define a basic configuration management file in the base directory to organize and manage multiple basic configuration files.
[0144] It should be noted that the basic configuration management file and the parameter definition management file can inherit from each other.
[0145] B1. Create a basic configuration file.
[0146] Define a specific basic configuration file (resources file). For example, if the application needs to use an application.properties file, and there are some parameters in the file that change with the environment, you need to create a resources file for the application.properties file and define the basic configuration file (application-properties.ConfigMap.yaml file) under / params / base / my-resources01. The parameters that change with the environment in the file are represented by placeholders (such as $(ENV_DATABASE_URL), which will be replaced with the actual parameter value in the current environment in subsequent steps.
[0147] Below is some basic configuration information code.
[0148] apiversion:"v1"
[0149] kind:"ConfigMap"
[0150] metadata:
[0151] name:"application-properties"
[0152] data:
[0153] application.properties:
[0154] spring.datasource.url=$(ENV_DATABASE_URL)
[0155] At this time, the ENV_DATABASE_URL variable is replaced by the placeholder $(ENV_DATABASE_URL).
[0156] B2. Create basic configuration management files.
[0157] Define the basic configuration management file under / params / base / my-resources01. This file is responsible for organizing one or more resource files (such as application-properties.ConfigMap.yaml files) that reference variables under the / params / base / my-resources01 directory. In addition, the file defines "app.<app name> .” format, which can be inherited by other management files.
[0158] The following is the specific code content in the basic configuration management file.
[0159] kind:"Kustomization"
[0160] namePrefix:app.my-app-name.
[0161] resources:
[0162] -application-properties.ConfigMap.yaml
[0163] S3. Create files in the environment directory.
[0164] In the environment directory, create a target parameter file, which includes the modified parameter items whose default values need to be modified in the application configuration under this environment, and the corresponding parameter modification values. At the same time, create a parameter management file in the environment directory to organize and manage the target parameter file.
[0165] It should be noted that the parameter management file, basic configuration management file and parameter definition management file can inherit from each other.
[0166] C1. Define the target parameter file.
[0167] Define the target parameter files (i.e., patch files) of the variables in the variable list (variable-list) for different environments and templates. For example, for the prod production environment and the my-template01 template, define the target parameter file (variable-list.ConfigMap.patch.yaml) of the variables in the production environment in the / params / overlays / prod / my-template01 directory. In this file, specify the actual value of the variable.
[0168] The following is the specific code content in the target parameter file.
[0169] apiVersion:"v1"
[0170] kind:"ConfigMap"
[0171] metadata:
[0172] name:"variable-list"
[0173] data
[0174] ENV_DATABASE_URL:"[prod:my-template01]this is database url!"
[0175] The default value of the ENV_DATABASE_URL variable is "this is the database url!". Here, the value of the variable is specified as the actual value "[prod:my-template01]this is the database url!".
[0176] C2. Define parameter management files.
[0177] Define parameter management files for different environments and templates. For example, for the prod production environment and the my-template01 template, define the parameter management file under / params / overlays / prod / my-template01. In this file, inherit the variable definition information, i.e. the parameter definition management file and the variable reference information, i.e. the basic configuration management file, as needed, and manage the variable-list.ConfigMap.patch.yaml file. In addition, the file defines "template.<template name> .” format.
[0178] The following is the specific code content in the parameter management file.
[0179] kind:"Kustomization*
[0180] namePrefix:template.my-template01.
[0181] patchesStrategicMerge:
[0182] -"variable-list.ConfigMap.patch.yaml"
[0183] bases:
[0184] #Inherit variable definition information.
[0185] ".. / .. / .. / base / variables"
[0186] #Inherit variable reference information. If you need to replace the placeholder for a file in a certain directory, enter the corresponding directory here.
[0187] -".., / base / my-resources01"
[0188] The above process is a pre-step for determining the application configuration information. The following is a detailed description of the step of determining the application information configuration.
[0189] S4. Receive an application configuration request, wherein the application configuration request carries an application identifier of a target application and an environment identifier corresponding to a target application environment.
[0190] Taking the production environment (prod) as an example, the production environment (prod) is the corresponding environment identifier.
[0191] S2. In response to the application configuration request, determine basic configuration information corresponding to the application identifier.
[0192] Determine the corresponding basic configuration directory, determine the basic configuration management file in the basic configuration directory, find multiple basic configuration files (application-properties.ConfigMap.yaml files) based on the basic configuration management file, and determine the basic configuration information based on multiple basic configuration files.
[0193] S3. Determine the target parameter value corresponding to the environmental identifier.
[0194] The variable changes defined in / params / overlays / prod / my-template01 / variable-list.ConfigMap.patch.yaml are automatically applied to the / params / base / variables / variable-list.ConfigMap.yaml file (patch operation). That is, the value of the ENV_DATABASE_URL variable is changed from "this is database url!" to "[prod:my-template01]this is database url!", completing the operation of modifying the default parameter value and generating a ConfigMap object named "template.my-template01.app.my-app-name.variable-list".
[0195] S4. Use the target parameter value to replace the predetermined placeholder in the basic configuration information to obtain the target configuration information in the target application environment.
[0196] First, the actual value of the ENV_DATABASE_URL variable is automatically read from the ConfigMap object named "template.my-template01.app.my-app-name.variable-list". Then, the actual value is used to replace the "$(ENV_DATABASE_URL)" placeholder in the / params / base / my-resources01 / application-properties.ConfigMap.yaml file, that is, the base configuration information.
[0197] After the placeholder replacement operation is completed, a ConfigMap object named "template.my-template01.app.my-app-name.application-properties" is generated based on the basic configuration information after variable replacement, that is, the / params / base / my-resources01 / application-properties.ConfigMap.yaml file for the application to use.
[0198] At this point, the definition, reference, and replacement of the ENV_DATABASE_URL variable are completed.
[0199] Through the above optional implementation, at least the following beneficial effects can be achieved:
[0200] (1) For files whose parameters need to change with different environments (such as application.properties files), users do not need to maintain multiple application.properties files. Instead, they only need to maintain one / params / base / my-resources01 / application-properties.ConfigMap.yaml file (which contains the complete content of the application.properties file). The container orchestration tool automatically replaces variable placeholders based on user definitions.
[0201] (2) The / params / base / my-resources01 / directory file is defined once, and the resources file can be repeatedly referenced by different environments and different templates; the / params / base / variables / directory file is defined once, and the variables can be shared by different environments and different templates. Different environments and different templates can set the variable values according to their needs;
[0202] (3) Through “template. <template-name>.app. <app-name>.variable-list". The same variable definition file / params / base / variables / variable-list.ConfigMap.yaml can generate multiple ConfigMap objects in the container orchestration platform cluster. Each ConfigMap object is <template-name>and <app-name>The prefix information is distinguished, avoiding the concurrent security issues caused by repeated modifications of the same ConfigMap object by different templates.
[0203] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0204] Example 2
[0205] The embodiment of the present application also provides a device for determining application configuration information. It should be noted that the device for determining application configuration information in the embodiment of the present application can be used to execute the method for determining application configuration information provided in the embodiment of the present application. The device for determining application configuration information provided in the embodiment of the present application is introduced below.
[0206] According to an embodiment of the present application, a device for implementing the above-mentioned method for determining application configuration information is also provided. Figure 3 is a schematic diagram of a device for determining application configuration information according to an embodiment of the present application, such as Figure 3 As shown, the device includes: a receiving module 302 , a first determining module 304 , a second determining module 306 and a first replacing module 308 .
[0207] A receiving module 302 is used to receive an application configuration request, wherein the application configuration request carries an application identifier of a target application and an environment identifier corresponding to a target application environment; a first determining module 304 is connected to the above-mentioned receiving module 302, and is used to determine, in response to the application configuration request, basic configuration information corresponding to the application identifier, wherein the basic configuration information includes a predetermined placeholder, which is a placeholder to be replaced, and is replaced by a target parameter value in the target application environment; a second determining module 306 is connected to the above-mentioned first determining module 304, and is used to determine the target parameter value corresponding to the environment identifier; a first replacement module 308 is connected to the above-mentioned second determining module 306, and is used to replace the predetermined placeholder in the basic configuration information with the target parameter value to obtain the target configuration information in the target application environment.
[0208] The device for determining application configuration information provided in the embodiment of the present application uses the target parameter value through the first replacement module 308 to replace the predetermined placeholder in the basic configuration information, thereby achieving the purpose of obtaining the target configuration information in the target application environment. Since the predetermined placeholder is used in the basic configuration information to replace the specific environment variable value in different deployment environments, after obtaining the target parameter value, the predetermined placeholder in the basic configuration information can be directly replaced to obtain the target configuration information. Determining the target configuration information in this way can reduce the number of files that record configuration information updates, simplify application version management, and further solve the problem of directly replacing the variable value of the environment variable in the configuration file in the related art, resulting in complex configuration file history records and increased difficulty in application management, thereby achieving the effect of being able to obtain accurate configuration information when the application switches between different environments, and making application expansion and configuration maintenance easier.
[0209] Optionally, the device for determining application configuration information provided in the embodiment of the present application also includes: a third determination module, used to determine a basic configuration directory corresponding to the target application based on the application identifier, wherein the basic configuration directory includes a first file path corresponding to multiple basic configuration files; a first calling module, used to call multiple basic configuration files based on multiple first file paths, wherein the multiple basic configuration files respectively include partial configuration information corresponding to the application identifier; and a fourth determination module, used to determine the basic configuration information based on multiple partial configuration information.
[0210] Optionally, the device for determining application configuration information provided in the embodiment of the present application also includes: a first creation module for creating a basic configuration management file under a basic configuration directory; and a second creation module for creating a first file path corresponding to multiple basic configuration files in the basic configuration management file.
[0211] Optionally, the device for determining application configuration information provided in the embodiment of the present application also includes: a fifth determination module, used to determine an environment directory corresponding to the target application environment based on the environment identifier, wherein the environment directory includes a parameter management file; and a sixth determination module, used to determine a target parameter value corresponding to the environment identifier based on the parameter management file.
[0212] Optionally, the device for determining application configuration information provided in the embodiment of the present application further includes: a seventh determination module, which is used to determine a modified placeholder and a default placeholder from multiple predetermined placeholders when the predetermined placeholder includes multiple and the target parameter value includes multiple, wherein the modified placeholder is a placeholder that uses a modified value after modifying the default parameter value at the corresponding placeholder position, and the default placeholder is a placeholder that uses a default parameter value at the corresponding placeholder position; an eighth determination module, which is used to determine a parameter definition file and a target parameter file based on a parameter management file, wherein the parameter definition file includes target parameters corresponding to the multiple predetermined placeholders, respectively. Items, and default parameter values corresponding to multiple target parameter items respectively, the target parameter file includes multiple modification parameter items corresponding to the environment identifier, and modification parameter values corresponding to the multiple modification parameter items respectively, and the multiple target parameter items include multiple modification parameter items; a ninth determination module, used to determine the default parameter value corresponding to the default placeholder according to the parameter definition file, and to determine the modification parameter value corresponding to the modification placeholder according to the target parameter file; a tenth determination module, used to determine the target parameter values corresponding to multiple predetermined placeholders respectively according to the default parameter values corresponding to the default placeholders respectively, and the modification parameter values corresponding to the modification placeholders.
[0213] Optionally, the device for determining application configuration information provided in the embodiment of the present application also includes: an eleventh determination module, used to determine the reference identifier corresponding to the parameter management file; a twelfth determination module, used to determine the parameter definition management file corresponding to the reference identifier, wherein the parameter definition management file includes a second file path corresponding to the parameter definition file; a thirteenth determination module, used to determine, based on the parameter management file, a third file path corresponding to the target parameter file; and a second calling module, used to call the parameter definition file based on the second file path, and to call the target parameter file based on the third file path.
[0214] Optionally, the device for determining application configuration information provided in the embodiment of the present application also includes: a twelfth determination module, used to determine a predetermined placeholder based on basic configuration information; a second replacement module, used to replace the predetermined placeholder with a target parameter value to obtain updated configuration information; a thirteenth determination module, used to check the updated configuration information, determine whether the updated configuration information includes the predetermined placeholder, and obtain a determination result; and a fourteenth determination module, used to determine the target configuration information in the target application environment when the determination result is that the predetermined placeholder is not included in the updated configuration information.
[0215] It should be noted that the receiving module 302, the first determining module 304, the second determining module 306 and the first replacing module 308 correspond to steps S202 to S208 in Embodiment 1, and the examples and application scenarios implemented by the multiple modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above Embodiment 1. It should be noted that the above modules or units may be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the above modules may also be part of a device and may be run in the computer terminal 10 provided in Embodiment 1.
[0216] Example 3
[0217] An embodiment of the present application may provide an electronic device, Figure 4 is a structural block diagram of an electronic device according to an embodiment of the present application. Figure 4 As shown, the electronic device may include: one or more ( Figure 4 Only one is shown) a processor, a memory, a storage controller, and a peripheral interface, wherein the peripheral interface is connected to a radio frequency module, an audio module, and a display.
[0218] Among them, the memory can be used to store software programs and modules, such as program instructions / modules corresponding to the methods and devices in the embodiments of the present application, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0219] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: receive an application configuration request, wherein the application configuration request carries an application identifier of the target application and an environment identifier corresponding to the target application environment; in response to the application configuration request, determine basic configuration information corresponding to the application identifier, wherein the basic configuration information includes a predetermined placeholder, which is a placeholder to be replaced and is replaced by a target parameter value in the target application environment; determine the target parameter value corresponding to the environment identifier; use the target parameter value to replace the predetermined placeholder in the basic configuration information to obtain the target configuration information in the target application environment.
[0220] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: determine the basic configuration directory corresponding to the target application based on the application identifier, wherein the basic configuration directory includes a first file path corresponding to multiple basic configuration files; based on the multiple first file paths, retrieve multiple basic configuration files, wherein the multiple basic configuration files respectively include partial configuration information corresponding to the application identifier; determine the basic configuration information based on the multiple partial configuration information.
[0221] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: creating a basic configuration management file under the basic configuration directory; creating a first file path corresponding to multiple basic configuration files in the basic configuration management file.
[0222] The processor can also call the information and application programs stored in the memory through the transmission device to perform the following steps: determine the environment directory corresponding to the target application environment based on the environment identifier, wherein the environment directory includes a parameter management file; determine the target parameter value corresponding to the environment identifier based on the parameter management file.
[0223] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: when there are multiple predetermined placeholders and multiple target parameter values, determine a modified placeholder and a default placeholder from the multiple predetermined placeholders, wherein the modified placeholder is a placeholder that uses a modified value after modifying the default parameter value at the corresponding placeholder position, and the default placeholder is a placeholder that uses the default parameter value at the corresponding placeholder position; determine a parameter definition file and a target parameter file based on the parameter management file, wherein the parameter definition file includes target parameter items corresponding to the multiple predetermined placeholders, and default parameter values corresponding to the multiple target parameter items, the target parameter file includes multiple modified parameter items corresponding to the environment identifier, and modified parameter values corresponding to the multiple modified parameter items, and the multiple target parameter items include multiple modified parameter items; determine the default parameter value corresponding to the default placeholder based on the parameter definition file, and determine the modified parameter value corresponding to the modified placeholder based on the target parameter file; determine the target parameter values corresponding to the multiple predetermined placeholders based on the default parameter values corresponding to the default placeholders and the modified parameter values corresponding to the modified placeholders.
[0224] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: determine the reference identifier corresponding to the parameter management file; determine the parameter definition management file corresponding to the reference identifier, wherein the parameter definition management file includes a second file path corresponding to the parameter definition file; determine the third file path corresponding to the target parameter file based on the parameter management file; call the parameter definition file based on the second file path, and call the target parameter file based on the third file path.
[0225] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: determine the predetermined placeholder based on the basic configuration information; use the target parameter value to replace the predetermined placeholder to obtain the updated configuration information; check the updated configuration information to determine whether the updated configuration information includes the predetermined placeholder and obtain a determination result; if the determination result is that the updated configuration information does not include the predetermined placeholder, obtain the target configuration information under the target application environment.
[0226] By using the embodiment of the present application, a solution for determining application configuration information is provided. By using the target parameter value to replace the predetermined placeholder in the basic configuration information, the purpose of obtaining the target configuration information in the target application environment is achieved. Since the predetermined placeholder is used in the basic configuration information to replace the specific environment variable value in different deployment environments, after obtaining the target parameter value, the predetermined placeholder in the basic configuration information can be directly replaced to obtain the target configuration information. Determining the target configuration information in this way can reduce the number of files that record configuration information updates, simplify application version management, and further solve the problem of directly replacing the variable value of the environment variable in the configuration file in the related art, resulting in complex configuration file history records and increased difficulty in application management, thereby achieving the effect of being able to obtain accurate configuration information when the application switches between different environments, and making application expansion and configuration maintenance easier.
[0227] It can be understood by those skilled in the art that Figure 4 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Figure 4 The structure of the electronic device is not limited. Figure 4 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 4 Different configurations are shown.
[0228] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0229] Example 4
[0230] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the method for determining application configuration information provided in the first embodiment.
[0231] Optionally, in this embodiment, the above-mentioned storage medium can be a computer-readable storage medium, and the computer-readable storage medium includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute any of the above-mentioned methods for determining the application configuration information.
[0232] Optionally, in this embodiment, the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0233] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing the program of the method steps for determining application configuration information.
[0234] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0235] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0236] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0237] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0238] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0239] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0240] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for determining application configuration information, characterized in that: include: Receive an application configuration request, wherein the application configuration request carries an application identifier of a target application and an environment identifier corresponding to a target application environment; In response to the application configuration request, determine basic configuration information corresponding to the application identifier, wherein the basic configuration information includes a predetermined placeholder, and the predetermined placeholder is a placeholder to be replaced, and is to be replaced by a target parameter value in the target application environment; Determining a target parameter value corresponding to the environmental identifier; The target parameter value is used to replace the predetermined placeholder in the basic configuration information to obtain the target configuration information in the target application environment.
2. The method according to claim 1, characterized in that The method of determining the basic configuration information corresponding to the application identifier in response to the application configuration request includes: Determine a basic configuration directory corresponding to the target application according to the application identifier, wherein the basic configuration directory includes a first file path corresponding to a plurality of basic configuration files; Retrieving the plurality of basic configuration files according to the plurality of first file paths, wherein the plurality of basic configuration files respectively include partial configuration information corresponding to the application identifier; The basic configuration information is determined according to a plurality of partial configuration information.
3. The method according to claim 2, characterized in that Before determining the basic configuration directory corresponding to the target application according to the application identifier, the method further includes: In the basic configuration directory, create a basic configuration management file; In the basic configuration management file, a first file path corresponding to the plurality of basic configuration files is created.
4. The method according to claim 1, characterized in that: The method for determining a target parameter value corresponding to the environment identifier includes: Determining, according to the environment identifier, an environment directory corresponding to the target application environment, wherein the environment directory includes a parameter management file; According to the parameter management file, a target parameter value corresponding to the environment identifier is determined.
5. The method according to claim 4, characterized in that The method for determining the target parameter value corresponding to the environment identifier according to the parameter management file includes: In the case that the predetermined placeholders include multiple ones and the target parameter values include multiple ones, a modified placeholder and a default placeholder are determined from the multiple predetermined placeholders, wherein the modified placeholder is a placeholder that uses a modified value after modifying the default parameter value at the corresponding placeholder position, and the default placeholder is a placeholder that uses a default parameter value at the corresponding placeholder position; Determining a parameter definition file and a target parameter file according to the parameter management file, wherein the parameter definition file includes target parameter items corresponding to the plurality of predetermined placeholders, and default parameter values corresponding to the plurality of target parameter items, the target parameter file includes a plurality of modification parameter items corresponding to the environment identifiers, and modification parameter values corresponding to the plurality of modification parameter items, and the plurality of target parameter items include the plurality of modification parameter items; Determining a default parameter value corresponding to the default placeholder according to the parameter definition file, and determining a modified parameter value corresponding to the modified placeholder according to the target parameter file; According to the default parameter values respectively corresponding to the default placeholders and the modified parameter values corresponding to the modified placeholders, target parameter values respectively corresponding to the plurality of predetermined placeholders are determined.
6. The method according to claim 5, characterized in that According to the parameter management file, a parameter definition file and a target parameter file are determined, including: Determine a reference identifier corresponding to the parameter management file; Determine a parameter definition management file corresponding to the reference identifier, wherein the parameter definition management file includes a second file path corresponding to the parameter definition file; Determining, according to the parameter management file, a third file path corresponding to the target parameter file; The parameter definition file is retrieved according to the second file path, and the target parameter file is retrieved according to the third file path.
7. The method according to any one of claims 1 to 6, characterized in that The method of using the target parameter value to replace the predetermined placeholder in the basic configuration information to obtain the target configuration information in the target application environment includes: Determining the predetermined placeholder according to the basic configuration information; Using the target parameter value, replacing the predetermined placeholder to obtain updated configuration information; Checking the update configuration information to determine whether the update configuration information includes the predetermined placeholder, and obtaining a determination result; When the determination result is that the update configuration information does not include the predetermined placeholder, target configuration information under the target application environment is determined.
8. A device for determining application configuration information, characterized in that: include: A receiving module, configured to receive an application configuration request, wherein the application configuration request carries an application identifier of a target application and an environment identifier corresponding to a target application environment; A first determination module is configured to determine, in response to the application configuration request, basic configuration information corresponding to the application identifier, wherein the basic configuration information includes a predetermined placeholder, and the predetermined placeholder is a placeholder to be replaced, and is to be replaced by a target parameter value in the target application environment; A second determination module, used to determine a target parameter value corresponding to the environmental identifier; The first replacement module is used to use the target parameter value to replace the predetermined placeholder in the basic configuration information to obtain the target configuration information in the target application environment.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored executable program, wherein when the executable program is run, the device where the computer-readable storage medium is located is controlled to execute the method for determining application configuration information according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: A memory storing an executable program; A processor is used to run the program, wherein the program executes the method for determining application configuration information as described in any one of claims 1 to 7 when running.
11. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and device for releasing software
CN103645900A
Application configuring methods and devices, storage mediums and electronic equipment
CN109547259A
Application deployment method and related device
CN112130866A
Application program deployment method and device
CN115951903A
Obtaining insights from a distributed system for a dynamic, customized, context-sensitive help system
US20170300482A1