Detailed Description
The system configuration method and the related device provided by the embodiment of the application improve the efficiency of configuring the system.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," "third," "fourth," and the like in the description and claims of this application and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
The following describes embodiments of the present application in detail.
Referring first to fig. 1, fig. 1 is a schematic system architecture diagram of a system configuration according to an embodiment of the present application. As shown in fig. 1, a system architecture of a system configuration includes a terminal 101 and a configuration management platform 102.
The terminal 101 may be a mobile phone, a tablet computer, a palm computer, a mobile internet device, or other types of terminals, and a user may log in the configuration management platform 102 through the terminal 101. When the terminal 101 runs, the system can configure the running environment of the system through the configuration management platform 102. Wherein the system comprises at least one component and the code of the system comprises a preset configuration file. The configuration management platform 102 is a web application, and includes a front-end part and a back-end part, wherein the front-end part is used for displaying an interactive interface on a browser and receiving a configuration request sent by a user through the terminal 101. Specifically, when a user logs in the configuration management platform 102, the user opens a browser, enters an interactive interface of the configuration management platform 102, can select a component to be configured in at least one component on the interactive interface, and then sends a configuration request.
Optionally, the configuration management platform 102 may also interface with a user management system, wherein the user management system is used for login authentication of a user. Specifically, when a user logs in the configuration management platform 102, a browser is opened, and a user name and a password of the user are input. The configuration management platform 102 sends the user name and the password to the user management system for authentication, and after the authentication is passed, the user is allowed to successfully log in the configuration management platform 102.
Specifically, when the terminal 101 runs, a user logs in the configuration management platform 102 through the terminal 101, the system includes at least one component, the code of the system includes a preset configuration file, and the configuration file includes first environment information supporting the system to run and configuration information configuring a running environment of the system. The configuration management platform 102 receives a configuration request of the terminal 101, where the configuration request carries component information of a component to be configured in the at least one component and second environment information of the component to be configured, where the second environment information is used to indicate an operating environment of the component to be configured in the terminal 101; the configuration management platform 102 analyzes the configuration file to obtain the first environment information and the configuration information; the configuration management platform 102 determines target environment information matched with the component to be configured in the first environment information according to the component information; the configuration management platform 102 compares the second environment information with the target environment information to determine target configuration information matched with the component to be configured in the configuration information; the configuration management platform 102 sends a configuration instruction carrying the target configuration information to the terminal 101, where the configuration instruction is used to instruct the terminal 101 to configure the operating environment of the component to be configured according to the target configuration information.
It can be seen that a configuration file is maintained in the code of the system in advance, and the configuration file comprises first environment information supporting the operation of the system and configuration information configuring the operation environment of the system. When the system runs at the terminal, the configuration management platform receives the configuration request of the terminal, and then the configuration management platform can automatically analyze the configuration file to obtain the configuration information, so that the running environment of the component to be configured of the system is configured. And when the running environment of the component to be configured changes, the configuration management platform can acquire the current environment information of the component to be configured and then determine the configuration information for configuring the current running environment of the component to be configured, so that the latest configuration of the running environment of the component to be configured is maintained, the configuration speed is high, and the efficiency of configuring the system is improved.
Referring to fig. 2, fig. 2 is a flowchart illustrating a system configuration method according to an embodiment of the present application, where the system includes at least one component, and a code of the system includes a preset configuration file, where the configuration file includes first environment information supporting operation of the system and configuration information configuring an operating environment of the system. As shown in fig. 2, the system configuration method provided in this embodiment may include:
201. receiving a configuration request of a terminal, wherein the configuration request carries component information of a component to be configured in the at least one component and second environment information of the component to be configured.
And the second environment information is used for indicating the operation environment of the component to be configured at the terminal.
Specifically, a user logs in the configuration management platform through a terminal, where the terminal may be a mobile phone, a tablet computer, a palm computer, a mobile internet device, or another type of terminal. The configuration management platform is a web application and comprises a front-end part and a back-end part, wherein the front-end part is used for displaying an interactive interface on a browser and receiving a configuration request sent by a user through a terminal. Specifically, when a user logs in the configuration management platform, the user opens a browser, enters an interactive interface of the configuration management platform, can select a component to be configured in at least one component on the interactive interface, and then sends a configuration request.
In one possible example, the configuration management platform may also interface with a user management system, where the user management system is used for login authentication of a user. Specifically, when a user logs in the configuration management platform, the browser is opened, and the user name and the password of the user are input. And the configuration management platform sends the user name and the password to the user management system for authentication, and the user is allowed to successfully log in the configuration management platform after the authentication is passed.
When the system runs at the terminal, the running environment of the system can be configured through the configuration management platform. The system comprises at least one component, and the code of the system comprises a preset configuration file, wherein the configuration file comprises first environment information supporting the operation of the system and configuration information configuring the operation environment of the system. The first environment information comprises environment information supporting the operation of all components in the system, and the configuration information is used for indicating the configuration of the current operation environment of all components in the system to ensure that the system can operate normally.
In one possible example, the configuration file is maintained in the code of the system in advance. When the configuration file is maintained, the configuration file is ensured to be consistent with the code version of the system, namely, each version of the code has a separate configuration file. In each version of configuration file, for a component of which the code is not updated, the environment information and the configuration information corresponding to the component can be multiplexed, so that the code writing amount of the configuration file can be reduced. Moreover, a version tool, such as Git and the like, is used for recording the configuration file of each version so as to ensure the tracing of the configuration file, the condition of confusion or conflict caused by excessive versions is avoided, and a correct format is provided for the subsequent unified configuration file.
A user logs in a configuration management platform, enters an interactive interface, can select a component to be configured in at least one component on the interactive interface, and then sends a configuration request. And the configuration management platform receives a configuration request of the terminal, wherein the configuration request carries the component information of the component to be configured and the second environment information of the component to be configured. Wherein the component information is used to distinguish between different components as the system comprises at least one component. After the component to be configured is determined, the terminal automatically identifies current second environment information of the component to be configured, the second environment information includes main environment information and sub-environment information, the main environment can be a development environment, a test environment or a production environment, for example, and the sub-environment is a specific environment in the main environment.
202. And analyzing the configuration file to obtain the first environment information and the configuration information.
Specifically, the configuration management platform receives the configuration request, and obtains component information of the component to be configured and second environment information of the component to be configured, which are carried by the configuration request. The configuration management platform analyzes the configuration file to obtain the first environment information and the configuration information.
In one possible example, before parsing the configuration file, the configuration management platform determines whether the received configuration request conforms to a preset rule; if the configuration request conforms to the preset rule, the configuration management platform acquires component information and second environment information carried by the configuration request, and analyzes the configuration file; and if the configuration request does not accord with the preset rule, the configuration management platform sends a configuration failure message to the terminal, wherein the configuration failure message is used for prompting the terminal to resend the configuration request.
Specifically, after receiving the configuration request, the configuration management platform first determines whether the configuration request meets a preset rule. If the configuration request conforms to the preset rule, the configuration management platform can acquire the information carried by the configuration request; if the configuration request does not conform to the preset rule, the configuration management platform cannot acquire information carried by the configuration request, and further needs to send a configuration failure message to the terminal, where the configuration failure message carries a specific configuration failure reason, for example, a component to be configured is not selected, and the configuration failure message is used to prompt the terminal to resend the configuration request. For example, when the terminal receives the configuration failure message, a popup window or an interface is generated, a specific configuration failure reason is displayed on the generated popup window or interface, and a configuration request is prompted to be resubmitted.
Based on the foregoing example, in a possible example, the configuration request further carries identification information of the terminal, and the determining, by the configuration management platform, whether the configuration request meets the preset rule includes: judging whether the identification information of the terminal passes the verification, if not, determining that the configuration request does not conform to the preset rule; if the identification information of the terminal passes the verification, acquiring at least one parameter in the configuration request, judging whether a null parameter exists in the at least one parameter, and if the null parameter exists in the at least one parameter, determining that the configuration request does not conform to a preset rule; if the at least one parameter does not have the empty parameter, acquiring the format of each parameter in the at least one parameter, checking the format of each parameter in the at least one parameter, and if the at least one parameter has the parameter with the wrong format, determining that the configuration request does not conform to the preset rule; and if the at least one parameter has no parameter with a format error, determining that the configuration request conforms to a preset rule.
Specifically, the configuration request carries identification information of the terminal, and the configuration management platform judges whether the identification information of the terminal passes verification. For example, token verification is adopted, a user sends a login request to a configuration management platform through a user name and a password, the configuration management platform verifies the login request, and a signed token is returned to the terminal. And the terminal receives and stores the token, and the identification information of the terminal is the token. When the terminal sends a configuration request to the configuration management platform, the token is carried in the configuration request, the configuration management platform obtains the token and carries out verification, if the verification is not passed, the configuration request is determined not to be in accordance with the preset rule, and the configuration management platform cannot return data.
And if the token carried by the configuration request passes the verification, the configuration management platform performs parameter non-empty verification on the configuration request. Specifically, the configuration management platform obtains at least one parameter in the configuration request, where the at least one parameter is, for example, a required parameter, then determines whether there is an empty parameter in the at least one parameter, and if there is an empty parameter in the at least one parameter, it is determined that the configuration request does not conform to a preset rule, and the configuration management platform cannot accurately obtain information carried by the configuration request.
And if the at least one parameter does not have the empty parameter, the configuration management platform performs format verification on the configuration request. Specifically, the configuration management platform obtains a format of each parameter in the at least one parameter, then, the format of each parameter is verified, and if a parameter with a wrong format exists in the at least one parameter, it is determined that the configuration request does not conform to a preset rule, and the configuration management platform cannot accurately analyze information carried by the configuration request.
If the at least one parameter does not have a parameter with a wrong format, determining that the configuration request conforms to a preset rule, acquiring component information and second environment information carried by the configuration request by the configuration management platform, and analyzing a configuration file by the configuration management platform to obtain first environment information and configuration information.
203. And determining target environment information matched with the component to be configured in the first environment information according to the component information.
Wherein the first environment information comprises environment information supporting the operation of all components in the system.
After obtaining the component information of the component to be configured, the configuration management platform may determine target environment information in the first environment information according to the component information, where the target environment information is environment information supporting operation of the component to be configured.
204. And comparing the second environment information with the target environment information to determine target configuration information matched with the component to be configured in the configuration information.
The second environment information indicates an operation environment of the component to be configured at the terminal, that is, the second environment information is current environment information of the component to be configured, and the target environment information is environment information supporting operation of the component to be configured. The configuration information is used for indicating the configuration of the current operating environment of all the components in the system so as to ensure that the system can operate normally.
The configuration management platform compares the second environment information with the target environment information, can determine the difference between the current environment of the component to be configured and the environment supporting the operation of the component to be configured, and can then determine the target configuration information matched with the component to be configured in the configuration information. The target configuration information is used for configuring the current environment of the component to be configured, so that the current environment of the component to be configured can support the running of the component to be configured.
205. And sending a configuration instruction carrying the target configuration information to the terminal, wherein the configuration instruction is used for indicating the terminal to configure the operating environment of the component to be configured according to the target configuration information.
And after determining the target configuration information, the configuration management platform sends a configuration instruction to the terminal, wherein the configuration instruction carries the target configuration information. The terminal receives the configuration instruction, acquires the target configuration information carried by the configuration instruction, and then configures the operating environment of the component to be configured according to the target configuration information, so that the operating environment of the component to be configured can support the component to be configured to operate.
When other components of the system are configured, the steps are repeated, and the other components of the system can be configured, so that the latest configuration of the system operation environment is maintained, and the normal operation of the system is ensured.
It can be seen that, with the system configuration method provided by the present application, when a system runs on a terminal, a configuration request of the terminal is received, where the configuration request carries component information of a component to be configured and second environment information of the component to be configured, where the second environment information is used to indicate an operating environment of the component to be configured on the terminal. Secondly, the configuration file is analyzed to obtain first environment information and configuration information. And secondly, determining target environment information matched with the component to be configured in the first environment information according to the component information. And secondly, comparing the second environment information with the target environment information to determine target configuration information matched with the component to be configured in the configuration information. And finally, sending a configuration instruction carrying the target configuration information to the terminal, wherein the configuration instruction is used for indicating the terminal to configure the operating environment of the component to be configured according to the target configuration information. Therefore, the configuration file is maintained in the code of the system in advance, and when the system runs at a terminal, the configuration file can be automatically analyzed to configure the running environment of the component to be configured of the system. When the running environment of the component to be configured changes, the current environment information of the component to be configured can be obtained, and then the configuration information for configuring the current running environment of the component to be configured is determined according to the configuration file, so that the latest configuration of the running environment of the component to be configured is maintained, the configuration speed is high, and the efficiency of configuring the system is improved.
Referring to fig. 3, fig. 3 is a flowchart illustrating another system configuration method according to an embodiment of the present application, where the system includes at least one component, and a code of the system includes a preset configuration file, where the configuration file includes first environment information that supports operation of the system and configuration information that configures an operating environment of the system. As shown in fig. 3, another system configuration method provided in this embodiment may include:
301. and the user logs in the configuration management platform through the terminal.
Specifically, a user logs in the configuration management platform through a terminal, where the terminal may be a mobile phone, a tablet computer, a palm computer, a mobile internet device, or another type of terminal. The configuration management platform is a web application and comprises a front-end part and a back-end part, wherein the front-end part is used for displaying an interactive interface on a browser and receiving a configuration request sent by a user through a terminal.
In one possible example, the configuration management platform may also interface with a user management system, where the user management system is used for login authentication of a user. Specifically, when a user logs in the configuration management platform, the browser is opened, and the user name and the password of the user are input. And the configuration management platform sends the user name and the password to the user management system for authentication, and the user is allowed to successfully log in the configuration management platform after the authentication is passed.
302. And the configuration management platform receives the configuration request of the terminal.
When the system runs at the terminal, the running environment of the system can be configured through the configuration management platform. The system comprises at least one component, and the code of the system comprises a preset configuration file, wherein the configuration file comprises first environment information supporting the operation of the system and configuration information configuring the operation environment of the system. The first environment information comprises environment information supporting the operation of all components in the system, and the configuration information is used for indicating the configuration of the current operation environment of all components in the system to ensure that the system can operate normally.
Specifically, a configuration file is maintained in the code of the system in advance. When the configuration file is maintained, the configuration file is ensured to be consistent with the code version of the system, namely, each version of the code has a separate configuration file. In each version of configuration file, for a component of which the code is not updated, the environment information and the configuration information corresponding to the component can be multiplexed, so that the code writing amount of the configuration file can be reduced. Moreover, a version tool, such as Git and the like, is used for recording the configuration file of each version so as to ensure the tracing of the configuration file, the condition of confusion or conflict caused by excessive versions is avoided, and a correct format is provided for the subsequent unified configuration file.
A user logs in a configuration management platform, enters an interactive interface, can select a component to be configured in at least one component on the interactive interface, and then sends a configuration request. The configuration management platform receives a configuration request of a terminal, wherein the configuration request carries component information of the component to be configured and second environment information of the component to be configured, and the second environment information is used for indicating the running environment of the component to be configured at the terminal. Wherein the component information is used to distinguish between different components as the system comprises at least one component. After the component to be configured is determined, the terminal automatically identifies current second environment information of the component to be configured, the second environment information includes main environment information and sub-environment information, the main environment can be a development environment, a test environment or a production environment, for example, and the sub-environment is a specific environment in the main environment.
303. The configuration management platform judges whether the configuration request conforms to a preset rule.
After receiving the configuration request, the configuration management platform first determines whether the configuration request meets a preset rule. If the configuration request conforms to the preset rule, the configuration management platform can acquire the information carried by the configuration request; if the configuration request does not conform to the preset rule, the configuration management platform cannot acquire the information carried by the configuration request.
Wherein, the configuration request carries the identification information of the terminal, and the step of judging whether the configuration request accords with the preset rule by the configuration management platform comprises the following steps: judging whether the identification information of the terminal passes the verification, if not, determining that the configuration request does not conform to the preset rule; if the identification information of the terminal passes the verification, acquiring at least one parameter in the configuration request, judging whether a null parameter exists in the at least one parameter, and if the null parameter exists in the at least one parameter, determining that the configuration request does not conform to a preset rule; if the at least one parameter does not have the empty parameter, acquiring the format of each parameter in the at least one parameter, checking the format of each parameter in the at least one parameter, and if the at least one parameter has the parameter with the wrong format, determining that the configuration request does not conform to the preset rule; and if the at least one parameter has no parameter with a format error, determining that the configuration request conforms to a preset rule.
Specifically, the configuration request carries identification information of the terminal, and the configuration management platform judges whether the identification information of the terminal passes verification. For example, token verification is adopted, a user sends a login request to a configuration management platform through a user name and a password, the configuration management platform verifies the login request, and a signed token is returned to the terminal. And the terminal receives and stores the token, and the identification information of the terminal is the token. When the terminal sends a configuration request to the configuration management platform, the token is carried in the configuration request, the configuration management platform obtains the token and carries out verification, if the verification is not passed, the configuration request is determined not to be in accordance with the preset rule, and the configuration management platform cannot return data.
And if the token carried by the configuration request passes the verification, the configuration management platform performs parameter non-empty verification on the configuration request. Specifically, the configuration management platform obtains at least one parameter in the configuration request, where the at least one parameter is, for example, a required parameter, then determines whether there is an empty parameter in the at least one parameter, and if there is an empty parameter in the at least one parameter, it is determined that the configuration request does not conform to a preset rule, and the configuration management platform cannot accurately obtain information carried by the configuration request.
And if the at least one parameter does not have the empty parameter, the configuration management platform performs format verification on the configuration request. Specifically, the configuration management platform obtains a format of each parameter in the at least one parameter, then, the format of each parameter is verified, and if a parameter with a wrong format exists in the at least one parameter, it is determined that the configuration request does not conform to a preset rule, and the configuration management platform cannot accurately analyze information carried by the configuration request.
And if the at least one parameter does not have the parameter with the format error, determining that the configuration request conforms to a preset rule.
304. If the configuration request does not conform to the preset rule, the configuration management platform sends a configuration failure message to the terminal.
If the configuration request does not conform to the preset rule, the configuration management platform cannot acquire information carried by the configuration request, and further needs to send a configuration failure message to the terminal, where the configuration failure message carries a specific configuration failure reason, for example, a component to be configured is not selected, and the configuration failure message is used to prompt the terminal to resend the configuration request. For example, when the terminal receives the configuration failure message, a popup window or an interface is generated, a specific configuration failure reason is displayed on the generated popup window or interface, and a configuration request is prompted to be resubmitted.
305. And if the configuration request conforms to the preset rule, the configuration management platform acquires the component information of the component to be configured and the second environment information of the component to be configured, which are carried by the configuration request.
The component information is used for distinguishing the component to be configured, and the second environment information is the current environment information of the component to be configured.
306. And the configuration management platform analyzes the configuration file to obtain first environment information and configuration information.
The configuration file comprises a json file, and the analyzing of the configuration file by the configuration management platform to obtain the first environment information and the configuration information comprises: performing deserialization processing on the json file to obtain at least one object; acquiring the attribute of each object in the at least one object, and determining the first environment information according to the attribute of each object, wherein the first environment information comprises environment information supporting the operation of each component in the at least one component; and acquiring a configuration item in each object, and determining the configuration information according to the configuration item in each object, wherein the configuration information is used for configuring the operating environment of each component in the at least one component.
Specifically, the configuration file is a json file, that is, the json file is maintained in the code of the system in advance. And the configuration management platform carries out deserialization processing on the json file to obtain at least one object. The attributes of the objects respectively identify environment information supporting system operation, for example, the environment supporting system operation may be a development environment, a test environment, or a production environment, and the first environment information may be determined according to the attributes of the objects. And, the configuration management platform acquires the configuration items in the object, thereby determining configuration information, which includes a plurality of configuration operations, such as add (add), update (update), delete (delete), release (release), and the like.
In a possible example, the configuration information includes a plurality of configuration operations, and after determining the configuration information, the configuration management platform further includes: the method comprises the steps that a configuration management platform obtains an operation type corresponding to each configuration operation in a plurality of configuration operations; classifying the plurality of configuration operations according to operation types to obtain a first type configuration operation, a second type configuration operation and a third type configuration operation, wherein the operation type corresponding to each configuration operation in the first type configuration operation is an addition type, the operation type corresponding to each configuration operation in the second type configuration operation is a deletion type, and the operation type corresponding to each configuration operation in the third type configuration operation is an update type.
Specifically, the configuration management platform determines configuration information, the configuration information includes a plurality of configuration operations, and the configuration management platform obtains an operation type corresponding to each configuration operation and classifies the plurality of configuration operations according to CRUD. Among them, CRUD refers to initials of several words of addition (create), reading (read), update (update), and deletion (delete) at the time of calculation processing. The configuration management platform classifies the determined configuration operations according to addition (create), deletion (delete) and update (update) to obtain a first type of configuration operation, a second type of configuration operation and a third type of configuration operation. The operation type corresponding to each configuration operation in the first type of configuration operation is an add (create) type, the operation type corresponding to each configuration operation in the second type of configuration operation is a delete (delete) type, and the operation type corresponding to each configuration operation in the third type of configuration operation is an update (update) type.
307. And the configuration management platform determines target environment information matched with the component to be configured in the first environment information according to the component information.
Specifically, the configuration management platform determines the identification information of the component to be configured according to the component information; the configuration management platform determines a target component matched with the identification information of the component to be configured in the at least one component; the configuration management platform determines target environment information supporting the target component to run in the first environment information.
308. And the configuration management platform compares the second environment information with the target environment information to determine the difference information between the second environment information and the target environment information.
The second environment information is the current environment information of the component to be configured, and the target environment information is the environment information supporting the operation of the configuration component.
The configuration management platform compares the second environment information with the target environment information, and can determine the difference between the current environment of the component to be configured and the environment supporting the operation of the component to be configured, that is, determine the difference information between the second environment information and the target environment information.
Wherein the difference information includes at least one of the first information, the second information, and the third information. The first information is information of the second environment information less than the target environment information, the second information is information of the second environment information more than the target environment information, and the third information is information of the second environment information different from the target environment information.
309. The configuration management platform determines target configuration information according to the difference information.
The target configuration information is used for configuring the current environment of the component to be configured, so that the current environment of the component to be configured can support the running of the component to be configured.
Wherein the target configuration information includes at least one of first configuration information, second configuration information, and third configuration information. The first configuration information comprises at least one configuration operation in the first type of configuration operation, and the first configuration information is used for adding first information in the second environment information; the second configuration information comprises at least one configuration operation in a second type of configuration operation, and the second configuration information is used for deleting second information in the second environment information; the third configuration information includes at least one configuration operation of a third class of configuration operations, the third configuration information for updating third information in the second environment information.
310. And the configuration management platform sends a configuration instruction carrying the target configuration information to the terminal.
311. And the terminal configures the operating environment of the component to be configured according to the target configuration information.
Specifically, the terminal receives the configuration instruction, acquires the target configuration information carried by the configuration instruction, and then configures the operating environment of the component to be configured according to the target configuration information, so that the operating environment of the component to be configured can support the component to be configured to operate.
When other components of the system are configured, the steps are repeated, and the other components of the system can be configured, so that the latest configuration of the system operation environment is maintained, and the normal operation of the system is ensured.
It can be seen that, by the system configuration method provided by the present application, the configuration file is maintained in the code of the system in advance, and when the system runs at the terminal, the configuration file can be automatically analyzed to configure the running environment of the component to be configured of the system. When the running environment of the component to be configured changes, the current environment information of the component to be configured can be obtained, and then the configuration information for configuring the current running environment of the component to be configured is determined according to the configuration file, so that the latest configuration of the running environment of the component to be configured is maintained, the configuration speed is high, and the efficiency of configuring the system is improved.
Referring to fig. 4, fig. 4 is a schematic flowchart illustrating a process of determining whether a configuration request meets a preset rule according to an embodiment of the present application. As shown in fig. 4, where the configuration request carries identification information of a terminal, and the determining, by the configuration management platform, whether the configuration request meets a preset rule includes: judging whether the identification information of the terminal passes the verification, if not, determining that the configuration request does not conform to the preset rule; if the identification information of the terminal passes the verification, acquiring at least one parameter in the configuration request, judging whether a null parameter exists in the at least one parameter, and if the null parameter exists in the at least one parameter, determining that the configuration request does not conform to a preset rule; if the at least one parameter does not have the empty parameter, acquiring the format of each parameter in the at least one parameter, checking the format of each parameter in the at least one parameter, and if the at least one parameter has the parameter with the wrong format, determining that the configuration request does not conform to the preset rule; and if the at least one parameter has no parameter with a format error, determining that the configuration request conforms to a preset rule.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating determining difference information between second environment information and target environment information according to an embodiment of the present application. As shown in fig. 5, the second environment information includes three pieces of information, which are AAA, BB, and CCC, respectively, the target environment information includes three pieces of information, which are BBB, CCC, and DDD, respectively, information included in the second environment information and the target environment information shown in fig. 5 is only an example, and may also include other information, and information included in the second environment information and the target environment information shown in fig. 5 is only an illustration, and may be other information. Comparing the second environment information with the target environment information, it can be seen that the DDD information is less in the second environment information than the target environment information, the AAA information is more in the second environment information than the target environment information, and BB information different from the target environment information exists in the second environment information, so that difference information can be determined, the difference information including the first information (DDD), the second information (AAA), and the third information (BB).
Referring to fig. 6, fig. 6 is a schematic diagram of a system configuration apparatus according to an embodiment of the present application, where the system includes at least one component, and the code of the system includes a preset configuration file, where the configuration file includes first environment information that supports operation of the system and configuration information that configures an operating environment of the system. As shown in fig. 6, a system configuration apparatus provided in an embodiment of the present application may include:
a receivingunit 601, configured to receive a configuration request of a terminal, where the configuration request carries component information of a component to be configured in the at least one component and second environment information of the component to be configured, where the second environment information is used to indicate an operating environment of the component to be configured in the terminal;
an analyzingunit 602, configured to analyze the configuration file to obtain the first environment information and the configuration information;
a first determiningunit 603, configured to determine, according to the component information, target environment information that is matched with the component to be configured in the first environment information;
a second determiningunit 604, configured to compare the second environment information with the target environment information, so as to determine target configuration information, which is matched with the component to be configured, in the configuration information;
a sendingunit 605, configured to send a configuration instruction carrying the target configuration information to the terminal, where the configuration instruction is used to instruct the terminal to configure the operating environment of the component to be configured according to the target configuration information.
For specific implementation of the system configuration apparatus in the present application, reference may be made to the embodiments of the system configuration method, which are not described herein again.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an electronic device in a hardware operating environment according to an embodiment of the present application. As shown in fig. 7, an electronic device of a hardware operating environment according to an embodiment of the present application may include:
aprocessor 701, such as a CPU.
Thememory 702, which may optionally be a high speed RAM memory, may also be a stable memory, such as a disk memory.
Acommunication interface 703 for implementing connection communication between theprocessor 701 and thememory 702.
Those skilled in the art will appreciate that the configuration of the electronic device shown in fig. 7 does not constitute a limitation of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 7, thememory 702 may include an operating system, a network communication module, and a system configuration program. An operating system is a program that manages and controls the hardware and software resources of an electronic device, supporting the operation of system configuration programs and other software or programs. The network communication module is used to enable communication between the components within thememory 702, as well as with other hardware and software in the electronic device.
In the electronic device shown in fig. 7, theprocessor 701 is configured to execute the system configuration program stored in thememory 702, and implement the following steps:
receiving a configuration request of a terminal, wherein the configuration request carries component information of a component to be configured in the at least one component and second environment information of the component to be configured, and the second environment information is used for indicating an operating environment of the component to be configured in the terminal;
analyzing the configuration file to obtain the first environment information and the configuration information;
determining target environment information matched with the component to be configured in the first environment information according to the component information;
comparing the second environment information with the target environment information to determine target configuration information matched with the component to be configured in the configuration information;
and sending a configuration instruction carrying the target configuration information to the terminal, wherein the configuration instruction is used for indicating the terminal to configure the operating environment of the component to be configured according to the target configuration information.
For specific implementation of the electronic device of the present application, reference may be made to various embodiments of the system configuration method, which are not described herein again.
Another embodiment of the present application provides a computer-readable storage medium storing a computer program for execution by a processor to perform the steps of:
receiving a configuration request of a terminal, wherein the configuration request carries component information of a component to be configured in the at least one component and second environment information of the component to be configured, and the second environment information is used for indicating an operating environment of the component to be configured in the terminal;
analyzing the configuration file to obtain the first environment information and the configuration information;
determining target environment information matched with the component to be configured in the first environment information according to the component information;
comparing the second environment information with the target environment information to determine target configuration information matched with the component to be configured in the configuration information;
and sending a configuration instruction carrying the target configuration information to the terminal, wherein the configuration instruction is used for indicating the terminal to configure the operating environment of the component to be configured according to the target configuration information.
For specific implementation of the computer-readable storage medium of the present application, reference may be made to the embodiments of the system configuration method, which are not described herein again.
It is also noted that while for simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present application is not limited by the order of acts, as some steps may, in accordance with the present application, occur in other orders and concurrently. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application. In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.