Configuration method and device for environment variables of server and storage medium
By acquiring server information and utilizing environment variable configuration tables that verify standardization and availability, the problem of low reliability in environment variable configuration in traditional IT systems is solved, achieving an efficient and accurate automatic configuration process.
Patent Information
- Application Number
- CN202511562560.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-29
- Publication Date
- 2026-01-16
AI Technical Summary
In traditional IT systems, environment variable configuration relies on manual operations or simple scripts, resulting in low configuration reliability, especially prone to errors in large distributed systems or environments with frequent updates.
By obtaining server information, the system automatically configures environment variables based on a standardization and availability verification table. Combined with mapping tables and verification rules, the system ensures the accuracy and reliability of the configuration.
It enables precise location and rapid retrieval of environment variable configurations, improves the reliability and accuracy of configuration, reduces human error, and enhances the automation of the configuration process.
Smart Images

Figure CN121349518A_ABST
Abstract
Description
Technical Field
[0001] This application relates to financial technology or other fields, and more specifically, to a method, apparatus, and storage medium for configuring environment variables for a server. Background Technology
[0002] In modern software development and deployment processes, environment variable configuration plays a crucial role. These variables typically include, but are not limited to, server IP (Internet Protocol) addresses, port numbers, database connection strings, authentication keys, and external service API (Application Programming Interface) keys. They are essential for ensuring that applications function correctly in different environments, such as development, testing, pre-production, and production environments. However, in traditional IT (Information Technology) system management practices, configuring environment variables is often a tedious and error-prone task.
[0003] In related technologies, the configuration of most environment variables still relies on manual operation or simple script assistance. This approach is not only inefficient but also highly susceptible to human error, especially in large distributed systems or environments with frequent updates, resulting in low configuration reliability.
[0004] There is currently no effective solution to the aforementioned problems in the relevant technologies. Summary of the Invention
[0005] The main objective of this application is to provide a method, apparatus, and storage medium for configuring environment variables on a server, in order to solve the problem of low reliability in configuring environment variables in related technologies.
[0006] To achieve the above objectives, according to one aspect of this application, a method for configuring environment variables on a server is provided. The method includes: obtaining server information of the server whose environment variables are to be configured, wherein the server information includes at least one of the following: the application scenario to which the server belongs, and the business type associated with the server; determining a target environment variable configuration table from multiple environment variable configuration tables based on the server information, wherein the environment variable configuration table is a configuration table that has passed normative validation and / or availability validation; and configuring environment variables on the server based on the target environment variable configuration table.
[0007] Optionally, the method for configuring environment variables on the server also includes: obtaining a target mapping table, wherein the target mapping table is used to record the mapping relationship between the application scenario, business type, and environment variable configuration table; determining the environment variable configuration table that matches the server information from the target mapping table based on the application scenario and business type in the server information; and determining the environment variable configuration table that matches the server information as the target environment variable configuration table.
[0008] Optionally, the method for configuring environment variables on the server further includes: before determining the target environment variable configuration table from multiple environment variable configuration tables based on server information, in response to the user's update operation on the environment variable template, obtaining an initial environment variable configuration table; performing a normalization check on the variable values in the initial environment variable configuration table according to preset check rules to obtain a first check result; identifying the target variable from the initial environment variable configuration table, performing an availability check on the variable values of the target variable to obtain a second check result; and determining target information based on the first check result and the second check result, wherein the target information indicates whether the initial environment variable configuration table is used as the environment variable configuration table.
[0009] Optionally, the method for configuring the server's environment variables may further include: identifying the variable used to indicate the connection address from the initial environment variable configuration table to obtain the target variable; sending a connection request to the connection address indicated by the target variable to obtain the connection result; and determining the second verification result based on the connection result of the connection request.
[0010] Optionally, the configuration method for the server's environment variables also includes: if the connection results of all target variables indicate a successful connection, determining that the second verification result indicates that the availability verification has passed; if the connection results of some target variables indicate that the connection has failed, determining that the second verification result indicates that the availability verification has failed.
[0011] Optionally, the method for configuring environment variables on the server further includes: before determining the target environment variable configuration table from multiple environment variable configuration tables based on server information, upon receiving a new template request, extracting the business type associated with the environment variable template to be created from the new template request; retrieving a reference environment variable template from the template library based on the business type associated with the environment variable template to be created, wherein the template library includes environment variable templates associated with multiple business types respectively; displaying the reference environment variable template, and obtaining the new environment variable template in response to the user's update operation on the reference environment variable template.
[0012] Optionally, the method for configuring environment variables on the server also includes: generating variable configuration instructions based on the target environment variable configuration table; sending variable configuration instructions to the server, wherein the server configures environment variables based on the target environment variable configuration table upon receiving the variable configuration instructions.
[0013] To achieve the above objectives, according to another aspect of this application, a device for configuring environment variables for a server is provided. The device includes: an acquisition module for acquiring server information of a server whose environment variables are to be configured, wherein the server information includes at least one of the following: the application scenario to which the server belongs, and the business type associated with the server; a first determination module for determining a target environment variable configuration table from multiple environment variable configuration tables based on the server information, wherein the environment variable configuration table is a configuration table that has passed normalization and / or availability checks; and a first processing module for configuring environment variables for the server based on the target environment variable configuration table.
[0014] Optionally, the first determining module further includes: an acquisition submodule, used to acquire a target mapping table, wherein the target mapping table is used to record the mapping relationship between the application scenario, business type, and environment variable configuration table; a first determining submodule, used to determine an environment variable configuration table that matches the server information from the target mapping table based on the application scenario and business type in the server information; and a second determining submodule, used to determine the environment variable configuration table that matches the server information as the target environment variable configuration table.
[0015] Optionally, the server's environment variable configuration device further includes: a second processing module, used to obtain an initial environment variable configuration table in response to a user's update operation on the environment variable template; a first verification module, used to perform normalization verification on the variable values in the initial environment variable configuration table according to preset verification rules, and obtain a first verification result; a second verification module, used to identify target variables from the initial environment variable configuration table, perform availability verification on the variable values of the target variables, and obtain a second verification result; and a second determination module, used to determine target information based on the first verification result and the second verification result, wherein the target information indicates whether the initial environment variable configuration table is used as the environment variable configuration table.
[0016] Optionally, the second verification module further includes: an identification submodule, used to identify the variable used to indicate the connection address from the initial environment variable configuration table to obtain the target variable; a first sending submodule, used to send a connection request to the connection address indicated by the target variable to obtain the connection result; and a third determining submodule, used to determine the second verification result based on the connection result of the connection request.
[0017] Optionally, the third determining submodule further includes: a first determining unit, used to determine that the second verification result characterizes the availability verification as passed if the connection results of all target variables indicate successful connection; and a second determining unit, used to determine that the second verification result characterizes the availability verification as failed if the connection results of some target variables indicate unsuccessful connection.
[0018] Optionally, the server's environment variable configuration device further includes: an extraction module, used to extract the business type associated with the environment variable template to be created from the new template request upon receiving a new template request; a retrieval module, used to retrieve a reference environment variable template from the template library based on the business type associated with the environment variable template to be created, wherein the template library includes environment variable templates associated with multiple business types respectively; and a display module, used to display the reference environment variable template and obtain the new environment variable template in response to the user's update operation on the reference environment variable template.
[0019] Optionally, the first processing module further includes: a generation submodule, used to generate variable configuration instructions based on the target environment variable configuration table; and a second sending submodule, used to send the variable configuration instructions to the server, wherein the server, upon receiving the variable configuration instructions, configures environment variables based on the target environment variable configuration table.
[0020] To achieve the above objectives, according to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored executable program, wherein, when the executable program is running, the method for configuring environment variables of the server described above controls the device where the computer-readable storage medium is located to execute.
[0021] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, comprising a memory storing an executable program; and a processor for running the program, wherein the program executes the above-described method for configuring environment variables of the server during runtime.
[0022] To achieve the above objectives, according to another aspect of this application, a computer program product is provided, including computer instructions that, when executed by a processor, implement the steps of the above-described method for configuring environment variables of a server.
[0023] In this embodiment, the target environment variable configuration table is determined from multiple environment variable configuration tables based on the server information of the server whose environment variables are to be configured. This enables the determination of server configuration requirements based on at least one of the application scenario and business type of the server to be configured, making the configuration process more targeted. It achieves accurate location and rapid retrieval of variable configuration information. By configuring the server's environment variables based on the target environment variable configuration table, automatic configuration of server environment variables is achieved according to a preset and matching configuration table, thereby improving the reliability of environment variable configuration. Furthermore, by setting the environment variable configuration table to one that has passed normativity and / or availability checks, the accuracy of the configuration table can be improved, further enhancing configuration reliability.
[0024] Therefore, the method provided in this application achieves the goal of automatically matching the environment variable configuration table based on server information to configure environment variables, thereby improving the reliability of environment variable configuration and solving the technical problem of low configuration reliability in related technologies. Attached Figure Description
[0025] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a hardware structure block diagram of a computer terminal provided according to an embodiment of this application; Figure 2 This is a flowchart illustrating a method for configuring server environment variables according to an embodiment of this application; Figure 3 This is a schematic diagram of a server environment variable configuration device according to an embodiment of this application; Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of this data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding access points are provided for users to choose to authorize or refuse. For example, interfaces are set up between this system and relevant users or organizations, providing users with corresponding access points to choose to agree to or refuse automated decision-making results; if the user chooses to refuse, the process proceeds to the expert decision-making stage.
[0029] Example 1
[0030] According to an embodiment of this application, an embodiment of a method for configuring environment variables of a server is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0031] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal (or mobile device) for implementing a method of configuring environment variables for a server is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor (MCU) or a field-programmable gate array (FPGA), etc.), 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 (I / O) interface, a Universal Serial Bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0032] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0033] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the server environment variable configuration method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the aforementioned server environment variable configuration method. The memory 104 may include high-speed random access memory, and may also include 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 memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0034] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0035] The display can be, for example, a touchscreen liquid crystal display (LCD), which allows the user to interact with the user interface of the computer terminal 10 (or mobile device).
[0036] Under the aforementioned operating environment, this application provides the following: Figure 2 The method for configuring environment variables on the server is shown. Figure 2 This is a flowchart of a method for configuring environment variables of a server according to Embodiment 1 of this application.
[0037] Step S201: Obtain the server information of the server whose environment variables are to be configured. The server information includes at least one of the following: the application scenario to which the server belongs, and the business type associated with the server.
[0038] Optionally, electronic devices, application systems, servers, or other similar devices can be used as the execution subject of this application. In this embodiment, the target processing system is used as the execution subject to execute the above-described method for configuring the server's environment variables.
[0039] The server information for the server whose environment variables are to be configured can be entered into the target processing system by staff. The application scenario to which the server belongs can be one of the following: development, testing, pre-production, production, disaster recovery, and the business type associated with the server can be one of the following: payment processing, data management, customer service, etc.
[0040] In an optional embodiment, the server information includes the application scenario to which the server belongs and the type of business associated with the server.
[0041] Step S202: Determine the target environment variable configuration table from multiple environment variable configuration tables based on server information, wherein the environment variable configuration table is a configuration table that has passed normalization and / or availability verification.
[0042] An environment variable configuration table is a data table that stores the environment variables and their value sets required in a specific environment (such as development, testing, or production) and / or a specific business type. Environment variables include, but are not limited to, IP addresses (IP addresses of accessed objects), port numbers (port numbers of accessed objects), database connection strings, authentication keys, external service API keys, and domain names. Different environment variable configuration tables are associated with different application scenarios and / or business types. Each environment variable configuration table undergoes both normativity validation (ensuring correct formatting, such as validating database IP formats) and availability validation (ensuring variable values are reasonable and usable in the current environment, such as testing whether the interface can be called normally). "Normalativity validation" and "availability validation" are key checks to ensure configuration correctness; the former focuses on the compliance of variable formats, while the latter emphasizes the actual function and effectiveness of the variables.
[0043] Once the server information is obtained, the target processing system can determine the target environment variable configuration table from multiple environment variable configuration tables based on the association between the server information and the environment variable configuration table.
[0044] For configuration tables that fail the standardization and / or availability checks, the target processing system can return the error reason in real time, allowing manual reconfiguration.
[0045] Step S203: Configure the server's environment variables based on the target environment variable configuration table.
[0046] After determining the target environment variable configuration table, configure the server's environment variables according to the variable values in the target environment variable configuration table.
[0047] In this embodiment, the target environment variable configuration table is determined from multiple environment variable configuration tables based on the server information of the server whose environment variables are to be configured. This enables the determination of server configuration requirements based on at least one of the application scenario and business type of the server to be configured, making the configuration process more targeted. It achieves accurate location and rapid retrieval of variable configuration information. By configuring the server's environment variables based on the target environment variable configuration table, automatic configuration of server environment variables is achieved according to a preset and matching configuration table, thereby improving the reliability of environment variable configuration. Furthermore, by setting the environment variable configuration table to one that has passed normativity and / or availability checks, the accuracy of the configuration table can be improved, further enhancing configuration reliability.
[0048] Therefore, the method provided in this application achieves the goal of automatically matching the environment variable configuration table based on server information to configure environment variables, thereby improving the reliability of environment variable configuration and solving the technical problem of low configuration reliability in related technologies.
[0049] Optionally, in the server environment variable configuration method provided in this application embodiment, when the server information includes application scenario and business type, determining the target environment variable configuration table from multiple environment variable configuration tables based on the server information includes: obtaining a target mapping table, wherein the target mapping table is used to record the mapping relationship between the application scenario, business type, and environment variable configuration table; determining the environment variable configuration table matching the server information from the target mapping table based on the application scenario and business type in the server information; and determining the environment variable configuration table matching the server information as the target environment variable configuration table.
[0050] Optionally, the target mapping table includes multiple records, each indicating the name of the environment variable configuration table corresponding to a specific application scenario and business type. At least one of the application scenario or business type must differ between records. For example, the target mapping table can be designed as a three-column table, with one column recording the application scenario, one column recording the business type, and the last column associated with the corresponding environment variable configuration table ID. When the system starts the configuration process, it loads this mapping table from a preset storage area (e.g., a database) to ensure the real-time nature and accuracy of the information.
[0051] The target processing system can search the target mapping table for matching environment variable configuration tables based on the application scenarios and business types contained in the server information. For example, it can look for records in the target mapping table that contain the application scenarios and business types from the server information, and identify the environment variable configuration table in that record as the environment variable configuration table that matches the server information, i.e., identify it as the target environment variable configuration table.
[0052] It's worth noting that the introduction of the target mapping table greatly enhances the specificity of the configuration, ensuring that each server obtains environment variable configurations that best suit its application scenario and business type. Secondly, the process of automatically matching and determining the target configuration table based on the target mapping table and server information improves the efficiency and accuracy of the configuration, avoiding errors that might be introduced by manual operations.
[0053] Optionally, in the server environment variable configuration method provided in this application embodiment, before determining the target environment variable configuration table from multiple environment variable configuration tables based on server information, the method further includes: obtaining an initial environment variable configuration table in response to a user's update operation on the environment variable template; performing a normalization check on the variable values in the initial environment variable configuration table according to preset check rules to obtain a first check result; identifying a target variable from the initial environment variable configuration table, performing an availability check on the variable values of the target variable to obtain a second check result; and determining target information based on the first check result and the second check result, wherein the target information indicates whether the initial environment variable configuration table is used as the environment variable configuration table.
[0054] Optionally, the environment variable template is a preset template, and different environment variable templates correspond to different application scenarios and / or business types. In an optional embodiment, the environment variable template defines the environment variables required under specific application scenarios and business types. For example, operations and maintenance personnel (i.e., staff) create environment variable templates through the system's front-end interactive interface, setting required variable fields (such as database IP and port) and optional fields (such as interface timeout time) in the environment variable template. Operations and maintenance personnel can also configure the field validation rules corresponding to the environment variable template (such as conditions that the IP format must meet). Afterwards, operations and maintenance personnel can select the created template and associate it with specific application scenarios (development / testing / pre-production / production) and business types. Then, operations and maintenance personnel can update the content of the environment variable template, that is, enter the specific values of each environment variable under the template under the corresponding scenario and business type (e.g., the database IP in the production environment is 10.0.0.1, and in the test environment it is 192.168.0.1). The target processing system responds to the user's update operation on the environment variable template, updates the environment variable template according to the update operation, and obtains the initial environment variable configuration table. The system can automatically establish and store the mapping relationship between "initial environment variable configuration table - application scenario - business type".
[0055] The initial environment variable configuration table generated after the update operation needs to undergo standardization validation to ensure the correct format of the variable values. The preset validation rules are a series of rules defined in the system to verify whether variable values conform to preset format and type requirements. For example, one sub-rule within a validation rule could be: check if a specific variable value is [a preset content] (such as an integer with a port number between 0 and 65535); if so, it meets the condition; otherwise, it does not. Another sub-rule could be: check if the order amount variable is an integer; if so, it meets the condition; otherwise, it does not. Yet another sub-rule could be: check if the date variable conforms to the YYYY-MM-DD format; if so, it meets the condition; otherwise, it does not.
[0056] The first verification result is used to characterize whether the standardization verification passes. Specifically, if there is no sub-rule in the verification rules that determines that the standardization verification passes, the first verification result is determined to characterize that the standardization verification passes. If there is a sub-rule in the verification rules that determines that the standardization verification fails, the first verification result is determined to characterize that the standardization verification fails.
[0057] Target variables refer to environment variables used to indicate connection addresses, such as database addresses and port numbers. Availability verification focuses on checking whether variable values are actually usable in the current environment; for example, whether a successful connection to the database or an external service can be made. For instance, it checks whether a connection can be made to [the value of the target variable]. If yes, the condition is met; otherwise, it is not. If all target variables meet the condition, the second verification result is used to characterize the availability verification as passed; if any target variable fails the condition, the second verification result is used to characterize the availability verification as failed.
[0058] Optionally, if both the first and second verification results indicate that the verification passed, the target information representation will use the initial environment variable configuration table as the environment variable configuration table. If either the first or second verification result indicates that the verification failed, the target information representation will not use the initial environment variable configuration table as the environment variable configuration table.
[0059] In an optional embodiment, detailed error information can be returned to the user in real time when verification fails, facilitating quick problem location and repair. Optionally, automatic reconfiguration is also performed after verification failure, avoiding manual intervention and requiring only manual verification to improve the automation and efficiency of configuration.
[0060] It should be noted that by combining rule validation and connectivity testing, the accuracy and availability of the configuration can be ensured, thereby improving the reliability of environment variable configuration.
[0061] Optionally, in the server environment variable configuration method provided in this application embodiment, identifying a target variable from an initial environment variable configuration table, performing availability verification on the variable value of the target variable, and obtaining a second verification result includes: identifying a variable used to indicate a connection address from the initial environment variable configuration table to obtain a target variable; sending a connection request to the connection address indicated by the target variable to obtain a connection result; and determining the second verification result based on the connection result of the connection request.
[0062] Variables indicating connection addresses refer to environment variables containing key information such as server IP, port, and domain name. These variables are primarily used for communication between the system and external resources or services. These variables are used as target variables. The system can design a variable identification algorithm to select variables indicating connection addresses from the initial environment variable configuration table through keyword search (such as IP). For example, a rule list can be set up, containing all possible variable names and patterns indicating connection information. The algorithm will iterate through all variables in the configuration table, matching them against this rule list, and marking the variables that meet the conditions as target variables.
[0063] After identifying the target variables, the system automatically sends connection requests to the connection addresses indicated by these variables to test the reachability and availability of these external resources or services. Through actual connection attempts, the correctness and validity of the connection information in the configuration table can be visually determined. The value of the target variable is the connection address it indicates.
[0064] If all connection results corresponding to the target variables indicate that the connection request was successful, then the variable values are considered valid and the second verification result is passed; conversely, if there are target variables whose connection results indicate that the connection request failed or there was no response, it means that there is a problem with the variable values or that the external resources are unreachable, and the second verification result will indicate that the verification failed.
[0065] For example, for database and interface variables, the system automatically initiates connection requests (such as attempting to connect to the database or calling the interface) to verify availability. If the verification fails, the system returns an error message in real time (such as "Database IP format error: 10.0.0"). After the operations and maintenance personnel fix the issue and re-trigger the configuration, the system automatically retryes. If the verification succeeds, the system generates a configuration success notification.
[0066] It should be noted that the above method enables reliable verification of the availability of target variables, ensuring that the server can communicate smoothly with external entities after configuring environment variables, reducing deployment failures or system malfunctions caused by connection problems, and thus effectively improving the reliability of variable configuration.
[0067] Optionally, in the server environment variable configuration method provided in this application embodiment, determining the second verification result based on the connection result of the connection request includes: if the connection result of all target variables indicates that the connection is successful, determining that the second verification result indicates that the availability verification is passed; if the connection result of some target variables indicates that the connection is unsuccessful, determining that the second verification result indicates that the availability verification is failed.
[0068] Optionally, if all connection results corresponding to the target variables indicate that the connection request was successful, then the variable values are considered valid and the second verification result is passed; conversely, if there are target variables whose connection results indicate that the connection request failed or there was no response, it means that there is a problem with the variable values or that the external resources are unreachable, and the second verification result will indicate that the verification failed.
[0069] It should be noted that the above method enables the accurate determination of the second verification result.
[0070] Optionally, in the server environment variable configuration method provided in this application embodiment, before determining the target environment variable configuration table from multiple environment variable configuration tables based on server information, the method further includes: upon receiving a new template request, extracting the business type associated with the environment variable template to be created from the new template request; retrieving a reference environment variable template from the template library based on the business type associated with the environment variable template to be created, wherein the template library includes environment variable templates associated with multiple business types respectively; displaying the reference environment variable template, and obtaining the new environment variable template in response to the user's update operation on the reference environment variable template.
[0071] Optionally, a new template request refers to a request submitted by operations personnel or system administrators to create a new environment variable template. The business type here refers to the nature of the system or service, such as payment processing, data analytics, or customer service; each business type may require specific environment variable configurations. The business type associated with the environment variable template to be created can be pre-filled by the operations personnel in the new template request.
[0072] After determining the business type, a reference environment variable template is retrieved from the template library. For example, based on the semantic similarity between the business type associated with the environment variable template to be created and the business types in the template library, the environment variable template associated with the business type with the highest semantic similarity in the template library is determined as the reference environment variable template. Another example is obtaining the business type architecture of the system where the server containing the environment variable to be configured resides. The business type architecture can be in the form of a tree structure, including the hierarchical relationship between the business types involved in the system. The target processing system can retrieve the reference environment variable template from the template library based on the business type architecture and the business type associated with the environment variable template to be created. For example, finding a business type at the same level as the business type of the environment variable template to be created, and determining the environment variable template corresponding to that business type at the same level as the reference variable template.
[0073] After determining the reference environment variable template, the system will display the template. Users can update the template according to their own needs. The system will record these updates and eventually generate a new environment variable template. The aforementioned update operations include, but are not limited to, adding, deleting, and modifying environment variable names.
[0074] It should be noted that the above method optimizes the environment variable template creation process. This not only improves the efficiency of environment variable template creation but also ensures the accuracy and applicability of the template content, providing a solid foundation for subsequent template-based environment variable configuration. This process, by reducing repetitive work, providing reference templates, and automatically recording updates, brings a higher degree of automation and a lower error rate to software system deployment and environment configuration management, enhancing the controllability and traceability of the configuration process.
[0075] Optionally, in the server environment variable configuration method provided in this application embodiment, configuring the server environment variables based on the target environment variable configuration table includes: generating a variable configuration instruction based on the target environment variable configuration table; sending the variable configuration instruction to the server, wherein the server configures the environment variables based on the target environment variable configuration table upon receiving the variable configuration instruction.
[0076] Optionally, after determining the target environment variable configuration table, the system will generate corresponding configuration instructions based on the variable information within it. These instructions will include the contents of the target environment variable configuration table. The system will then send the generated configuration instructions to the target server. Upon receiving the instructions, the server will set the corresponding environment variables according to the information in the instructions, ensuring that the configuration information takes effect on the server. This process supports batch processing and can configure multiple servers simultaneously.
[0077] Optionally, if the environment variables imported from the server conflict with the existing environment variables on the server (same name, different values), the target processing system can automatically provide a repair solution based on the usage scenario (e.g., the test environment takes priority for the test data source value), or select the optimal value by default based on historical usage frequency.
[0078] It should be noted that the above method enables effective configuration of server environment variables and improves configuration reliability.
[0079] In an optional embodiment, the target processing system can also perform real-time value synchronization after configuring environment variables. For example, if the environment variables of the source server (such as the "interface timeout time" in the data source) are updated, the downstream servers of the source server are automatically triggered to synchronize and update the associated environment variables, and a change notification is pushed (e.g., variable A has been updated from 30s to 60s, affecting script A / service).
[0080] In an optional embodiment, the target processing system can also perform usage tracing. For example, it records the import source, usage chain, and modification records of sensitive environmental variables, and automatically blocks and traces the operator in the event of a leakage risk (such as an unauthorized role attempting to read the data).
[0081] Therefore, the method provided in this application achieves the goal of automatically matching the environment variable configuration table based on server information to configure environment variables, thereby improving the reliability of environment variable configuration and solving the technical problem of low configuration reliability in related technologies.
[0082] It should be noted that the steps shown in the flowchart in 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 may be executed in a different order than that shown here.
[0083] Example 2
[0084] This application also provides a server environment variable configuration device. It should be noted that the server environment variable configuration device of this application can be used to execute the server environment variable configuration method provided in this application. The server environment variable configuration device provided in this application will be described below.
[0085] According to embodiments of this application, an apparatus for implementing the above-described method for configuring environment variables of a server is also provided, such as... Figure 3 As shown, the device includes: The acquisition module 301 is used to acquire server information of the server to be configured environment variables, wherein the server information includes at least one of the following: the application scenario to which the server belongs, and the business type associated with the server; The first determining module 302 is used to determine the target environment variable configuration table from multiple environment variable configuration tables based on server information, wherein the environment variable configuration table is a configuration table that has passed normalization verification and / or availability verification. The first processing module 303 is used to configure environment variables for the server based on the target environment variable configuration table.
[0086] In this embodiment, the target environment variable configuration table is determined from multiple environment variable configuration tables based on the server information of the server whose environment variables are to be configured. This enables the determination of server configuration requirements based on at least one of the application scenario and business type of the server to be configured, making the configuration process more targeted. It achieves accurate location and rapid retrieval of variable configuration information. By configuring the server's environment variables based on the target environment variable configuration table, automatic configuration of server environment variables is achieved according to a preset and matching configuration table, thereby improving the reliability of environment variable configuration. Furthermore, by setting the environment variable configuration table to one that has passed normativity and / or availability checks, the accuracy of the configuration table can be improved, further enhancing configuration reliability.
[0087] Therefore, the method provided in this application achieves the goal of automatically matching the environment variable configuration table based on server information to configure environment variables, thereby improving the reliability of environment variable configuration and solving the technical problem of low configuration reliability in related technologies.
[0088] Optionally, in the server environment variable configuration device provided in this application embodiment, the first determining module further includes: an acquisition submodule, used to acquire a target mapping table, wherein the target mapping table is used to record the mapping relationship between the application scenario, business type, and environment variable configuration table; the first determining submodule is used to determine the environment variable configuration table matching the server information from the target mapping table based on the application scenario and business type in the server information; and the second determining submodule is used to determine the environment variable configuration table matching the server information as the target environment variable configuration table.
[0089] Optionally, in the server environment variable configuration device provided in this application embodiment, the server environment variable configuration device further includes: a second processing module, used to obtain an initial environment variable configuration table in response to a user's update operation on the environment variable template; a first verification module, used to perform normalization verification on the variable values in the initial environment variable configuration table according to preset verification rules, and obtain a first verification result; a second verification module, used to identify target variables from the initial environment variable configuration table, perform availability verification on the variable values of the target variables, and obtain a second verification result; and a second determination module, used to determine target information based on the first verification result and the second verification result, wherein the target information indicates whether the initial environment variable configuration table is used as the environment variable configuration table.
[0090] Optionally, in the server environment variable configuration device provided in this application embodiment, the second verification module further includes: an identification submodule, used to identify the variable used to indicate the connection address from the initial environment variable configuration table to obtain the target variable; a first sending submodule, used to send a connection request to the connection address indicated by the target variable to obtain the connection result; and a third determining submodule, used to determine the second verification result based on the connection result of the connection request.
[0091] Optionally, in the server environment variable configuration device provided in the embodiments of this application, the third determining submodule further includes: a first determining unit, configured to determine that the second verification result indicates that the availability verification has passed when all connection results of the target variables indicate successful connection; and a second determining unit, configured to determine that the second verification result indicates that the availability verification has failed when there are connection results of the target variables indicating unsuccessful connection.
[0092] Optionally, in the server environment variable configuration device provided in this application embodiment, the server environment variable configuration device further includes: an extraction module, used to extract the business type associated with the environment variable template to be created from the new template request when a new template request is received; a retrieval module, used to retrieve a reference environment variable template from the template library based on the business type associated with the environment variable template to be created, wherein the template library includes environment variable templates associated with multiple business types respectively; and a display module, used to display the reference environment variable template and obtain the new environment variable template in response to the user's update operation on the reference environment variable template.
[0093] Optionally, in the server environment variable configuration device provided in this application embodiment, the first processing module further includes: a generation submodule, used to generate variable configuration instructions based on the target environment variable configuration table; and a second sending submodule, used to send the variable configuration instructions to the server, wherein the server configures environment variables based on the target environment variable configuration table upon receiving the variable configuration instructions.
[0094] It should be noted that the acquisition module 301, the first determination module 302, and the first processing module 303 mentioned above correspond to steps S201 to S203 in Embodiment 1. The three modules and their corresponding steps implement the same instances and application scenarios, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above modules can also be part of a device and run in the computer terminal 10 provided in Embodiment 1.
[0095] Example 3
[0096] Embodiments of this application may provide an electronic device. Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 4 As shown, the electronic device may include: one or more ( Figure 4 (Only one is shown) processor 1002, memory 1004, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0097] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include 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 memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0098] The processor can access information and applications stored in memory via a transmission device to perform the following steps: obtaining server information of the server whose environment variables are to be configured, wherein the server information includes at least one of the following: the application scenario to which the server belongs, the business type associated with the server; determining a target environment variable configuration table from multiple environment variable configuration tables based on the server information, wherein the environment variable configuration table is a configuration table that has passed normative verification and / or availability verification; configuring environment variables for the server based on the target environment variable configuration table.
[0099] The processor can also access information and applications stored in the memory via a transmission device to perform the following steps: obtaining a target mapping table, wherein the target mapping table is used to record the mapping relationship between application scenarios, business types, and environment variable configuration tables; determining an environment variable configuration table that matches the server information from the target mapping table based on the application scenarios and business types in the server information; and determining the environment variable configuration table that matches the server information as the target environment variable configuration table.
[0100] The processor can also invoke information and applications stored in memory via a transmission device to perform the following steps: before determining the target environment variable configuration table from multiple environment variable configuration tables based on server information, in response to the user's update operation on the environment variable template, an initial environment variable configuration table is obtained; the variable values in the initial environment variable configuration table are subjected to normalization verification according to preset verification rules to obtain a first verification result; the target variable is identified from the initial environment variable configuration table, and the variable value of the target variable is subjected to availability verification to obtain a second verification result; the target information is determined based on the first verification result and the second verification result, wherein the target information indicates whether the initial environment variable configuration table is used as the environment variable configuration table.
[0101] The processor can also invoke information and applications stored in memory via a transmission device to perform the following steps: identify the variable used to indicate the connection address from the initial environment variable configuration table to obtain the target variable; send a connection request to the connection address indicated by the target variable to obtain the connection result; and determine the second verification result based on the connection result of the connection request.
[0102] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: if the connection results of all target variables indicate that the connection is successful, determine that the second verification result indicates that the availability verification has passed; if the connection results of some target variables indicate that the connection is unsuccessful, determine that the second verification result indicates that the availability verification has failed.
[0103] The processor can also invoke information and applications stored in the memory via a transmission device to perform the following steps: before determining the target environment variable configuration table from multiple environment variable configuration tables based on server information, upon receiving a new template request, extracting the business type associated with the environment variable template to be created from the new template request; based on the business type associated with the environment variable template to be created, retrieving a reference environment variable template from the template library, wherein the template library includes environment variable templates associated with multiple business types respectively; displaying the reference environment variable template, and in response to the user's update operation on the reference environment variable template, obtaining the newly created environment variable template.
[0104] The processor can also access information and applications stored in memory via a transmission device to perform the following steps: generating variable configuration instructions based on the target environment variable configuration table; sending the variable configuration instructions to the server, wherein the server, upon receiving the variable configuration instructions, configures environment variables based on the target environment variable configuration table.
[0105] In this embodiment, the target environment variable configuration table is determined from multiple environment variable configuration tables based on the server information of the server whose environment variables are to be configured. This enables the determination of server configuration requirements based on at least one of the application scenario and business type of the server to be configured, making the configuration process more targeted. It achieves accurate location and rapid retrieval of variable configuration information. By configuring the server's environment variables based on the target environment variable configuration table, automatic configuration of server environment variables is achieved according to a preset and matching configuration table, thereby improving the reliability of environment variable configuration. Furthermore, by setting the environment variable configuration table to one that has passed normativity and / or availability checks, the accuracy of the configuration table can be improved, further enhancing configuration reliability.
[0106] Therefore, the method provided in this application achieves the goal of automatically matching the environment variable configuration table based on server information to configure environment variables, thereby improving the reliability of environment variable configuration and solving the technical problem of low configuration reliability in related technologies.
[0107] Those skilled in the art will understand that Figure 4 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 4 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 4 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 4 The different configurations shown.
[0108] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0109] Example 4
[0110] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the server environment variable configuration method provided in Embodiment 1.
[0111] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0112] This application also provides a computer program product that, when executed on a data processing device, is suitable for performing steps of configuring environment variables for a server.
[0113] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0114] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0115] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0116] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0117] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0118] If the integrated unit is implemented as 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 this 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. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0119] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method of configuring an environment variable of a server, characterized by, The method comprises the following steps: obtaining server information of a server to be configured with environment variables, wherein the server information comprises at least one of the following: an application scenario to which the server belongs, and a business type associated with the server; determining a target environment variable configuration table from a plurality of environment variable configuration tables based on the server information, wherein the environment variable configuration table is a configuration table that passes a specification check and / or an availability check; configuring the server with environment variables based on the target environment variable configuration table.
2. The method of claim 1, wherein, In the case where the server information comprises the application scenario and the business type, determining the target environment variable configuration table from the plurality of environment variable configuration tables based on the server information comprises: obtaining a target mapping table, wherein the target mapping table is used to record a mapping relationship among an application scenario, a business type, and an environment variable configuration table; determining, from the target mapping table, an environment variable configuration table that matches the server information based on the application scenario and the business type in the server information; determining the environment variable configuration table that matches the server information as the target environment variable configuration table.
3. The method of claim 1, wherein, Before determining the target environment variable configuration table from the plurality of environment variable configuration tables based on the server information, the method further comprises: obtaining an initial environment variable configuration table in response to a user's update operation on an environment variable template; performing a specification check on variable values in the initial environment variable configuration table according to a preset check rule to obtain a first check result; identifying a target variable from the initial environment variable configuration table, and performing an availability check on a variable value of the target variable to obtain a second check result; determining target information based on the first check result and the second check result, wherein the target information indicates whether the initial environment variable configuration table is used as the environment variable configuration table.
4. The method of claim 3, wherein, Identifying a target variable from the initial environment variable configuration table, and performing an availability check on a variable value of the target variable to obtain a second check result comprises: identifying a variable used to indicate a connection address from the initial environment variable configuration table to obtain the target variable; sending a connection request to the connection address indicated by the target variable to obtain a connection result; determining the second check result based on the connection result of the connection request.
5. The method of claim 4, wherein, Determining the second check result based on the connection result of the connection request comprises: in the case where the connection results of all target variables indicate a successful connection, determining that the second check result indicates that the availability check passes; in the case where the connection result of a target variable indicates an unsuccessful connection, determining that the second check result indicates that the availability check fails.
6. The method of claim 1, wherein, Before determining the target environment variable configuration table from the plurality of environment variable configuration tables based on the server information, the method further comprises: in the case where a new template request is received, extracting a business type associated with an environment variable template to be created from the new template request; based on the business type associated with the environment variable template to be created, retrieving a reference environment variable template from a template library, wherein the template library comprises a plurality of environment variable templates respectively associated with business types. The reference environment variable template is displayed, and a newly created environment variable template is obtained in response to a user updating operation on the reference environment variable template.
7. The method of claim 1, wherein, The server is configured with environment variables based on the target environment variable configuration table, including: Generating a variable configuration instruction based on the target environment variable configuration table; Sending the variable configuration instruction to the server, wherein the server configures environment variables based on the target environment variable configuration table upon receiving the variable configuration instruction.
8. An environment variable configuration apparatus of a server, characterized by comprising: Including: An acquisition module configured to acquire server information of a server to be configured with environment variables, wherein the server information includes at least one of the following: an application scenario to which the server belongs, and a business type associated with the server; A first determination module configured to determine a target environment variable configuration table from a plurality of environment variable configuration tables based on the server information, wherein the environment variable configuration table is a configuration table that passes a specification check and / or an availability check; A first processing module configured to configure the server with environment variables based on the target environment variable configuration table.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein the executable program controls the device in which the computer-readable storage medium is located to perform the method for configuring environment variables of the server according to any one of claims 1 to 7 when the executable program is running.
10. An electronic device, comprising: Including: A memory storing an executable program; A processor configured to run the program, wherein the program performs the method for configuring environment variables of the server according to any one of claims 1 to 7 when the program is running.