CN114090074A - Method and device for configuring operating environment, storage medium and electronic device - Google Patents

Method and device for configuring operating environment, storage medium and electronic device Download PDF

Info

Publication number
CN114090074A
CN114090074A CN202111249327.9A CN202111249327A CN114090074A CN 114090074 A CN114090074 A CN 114090074A CN 202111249327 A CN202111249327 A CN 202111249327A CN 114090074 A CN114090074 A CN 114090074A
Authority
CN
China
Prior art keywords
target
environment
code
operating
subfile
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111249327.9A
Other languages
Chinese (zh)
Inventor
石斐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Haier Technology Co Ltd, Haier Smart Home Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202111249327.9A priority Critical patent/CN114090074A/en
Publication of CN114090074A publication Critical patent/CN114090074A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

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

Abstract

The invention discloses a configuration method and a configuration device of a running environment, a storage medium and an electronic device, wherein the method comprises the following steps: under the condition of receiving an operation instruction corresponding to a target code, determining an operation environment to be called at a server side of the target code according to the operation instruction; determining a first subfile to be executed in a configuration file corresponding to the target code according to the running environment, wherein the configuration file is used for indicating a set of variable parameters to be modified when the target code is adapted to different running environments; analyzing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining a configuration requirement for operating the target code on the server according to the target variable parameter; the method solves the problems that different configuration requirements and the like corresponding to the switching of the code between different operation environments cannot be efficiently determined.

Description

Method and device for configuring operating environment, storage medium and electronic device
Technical Field
The present invention relates to the field of communications, and in particular, to a method and an apparatus for configuring an operating environment, a storage medium, and an electronic apparatus.
Background
At present, when a front-end application is developed, a developer needs to manually configure corresponding environment variable parameters according to different configuration requirements of different environments, so that the environment requirements are met, when a code to be developed needs to be changed according to the configuration requirements of different operating environments, the cost for modifying the code is high, development time is greatly wasted, and the fault risk of manual configuration is high, so that the development period is greatly prolonged.
Aiming at the problems that different configuration requirements and the like corresponding to codes in switching among different operating environments cannot be determined efficiently in the related art, an effective solution is not provided yet.
Disclosure of Invention
The embodiment of the invention provides a configuration method and device of operating environments, a storage medium and an electronic device, which are used for at least solving the problems that different configuration requirements and the like corresponding to codes switched between different operating environments cannot be determined efficiently in the related art.
According to an embodiment of the present invention, there is provided a method for configuring an operating environment, including: under the condition of receiving an operation instruction corresponding to a target code, determining an operation environment to be called at a server side of the target code according to the operation instruction; determining a first subfile to be executed in a configuration file corresponding to the target code according to the running environment, wherein the configuration file is used for indicating a set of variable parameters to be modified when the target code is adapted to different running environments; and analyzing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining a configuration requirement for operating the target code on the server according to the target variable parameter.
In an exemplary embodiment, before determining, according to the execution environment, a first subfile to be executed in a configuration file corresponding to the object code, the method further includes: acquiring basic information of an operating environment allowing the target code to be operated, wherein the basic information is used for indicating the operating requirement of the target code in the operating environment; generating a target subfile matched with the target code and the running environment according to the basic information; and combining a plurality of target subfiles to obtain a configuration file corresponding to the target code under the condition that a plurality of running environments of the target code exist at the same time.
In an exemplary embodiment, after generating a target subfile in which the target code matches the execution environment according to the basic information, the method further includes: receiving a maintenance instruction sent by a target object, wherein the maintenance instruction is used for carrying variable parameters configuring a target subfile, and the variable parameters are used for indicating a function corresponding to an updated operating environment; and modifying the target variable parameters in the target subfile according to the maintenance instruction.
In an exemplary embodiment, when a plurality of running environments of the object code exist simultaneously, after combining a plurality of object subfiles to obtain a configuration file corresponding to the object code, the method further includes: associating a process command of the object code with the configuration file, wherein the process command includes at least one of: operating commands and packaging commands; and matching target reading operation corresponding to the processing command according to the correlation result, wherein the target reading operation is used for indicating the reading direction of the server to the information in the target code.
In an exemplary embodiment, modifying the target variable parameter in the target subfile according to the maintenance instruction includes: determining all variable parameters of the modified target subfile; and adding all the variable parameters into the global variable of the target code according to a preset rule.
In an exemplary embodiment, determining a first subfile to be executed in a configuration file corresponding to the object code according to the execution environment includes: determining the running environment to which the target code is to be configured; and under the condition that the operating environment to be configured meets the operating conditions of the object code, determining a first subfile to be executed in a corresponding configuration file in the object code according to the operating environment, wherein the first subfile is one of a plurality of target subfiles in the configuration file.
In an exemplary embodiment, after parsing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining a configuration requirement for operating the target code on the server according to the target variable parameter, the method further includes: sending prompt information to a display interface corresponding to the server under the condition that the target operation environment needs to be switched; receiving a target operation instruction input according to the prompt message, wherein the target operation instruction at least comprises one of the following instructions: the running command of the object code and the packaging command of the object code.
According to another embodiment of the present invention, there is also provided an apparatus for configuring an operating environment, including: the first determining module is used for determining the operating environment to be called of the target code at the server according to the operating instruction under the condition that the operating instruction corresponding to the target code is received; a second determining module, configured to determine, according to the operating environment, a first subfile to be executed in a configuration file corresponding to the target code, where the configuration file is used to indicate a set of variable parameters to be modified when the target code is adapted to different operating environments; and the calling module is used for analyzing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining the configuration requirement for operating the target code on the server according to the target variable parameter.
In an exemplary embodiment, the apparatus further includes: the acquisition module is used for acquiring basic information of an operating environment allowing the target code to operate, wherein the basic information is used for indicating the operating requirement of the target code in the operating environment; generating a target subfile matched with the target code and the running environment according to the basic information; and combining a plurality of target subfiles to obtain a configuration file corresponding to the target code under the condition that a plurality of running environments of the target code exist at the same time.
In an exemplary embodiment, the obtaining module further includes: the system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a maintenance instruction sent by a target object, the maintenance instruction is used for carrying variable parameters configuring a target subfile, and the variable parameters are used for indicating a function corresponding to an updated operating environment; and modifying the target variable parameters in the target subfile according to the maintenance instruction.
In an exemplary embodiment, the obtaining module further includes: a matching unit, configured to associate a processing command of the target code with the configuration file, wherein the processing command includes at least one of: operating commands and packaging commands; and matching target reading operation corresponding to the processing command according to the correlation result, wherein the target reading operation is used for indicating the reading direction of the server to the information in the target code.
In an exemplary embodiment, the receiving unit is further configured to determine all variable parameters of the modified target subfile; and adding all the variable parameters into the global variable of the target code according to a preset rule.
In an exemplary embodiment, the invoking module is further configured to determine that the execution environment determines an execution environment to be configured for the target code; and under the condition that the operating environment to be configured meets the operating conditions of the object code, determining a first subfile to be executed in a corresponding configuration file in the object code according to the operating environment, wherein the first subfile is one of a plurality of target subfiles in the configuration file.
In an exemplary embodiment, the apparatus further includes: the prompt module is used for sending prompt information to a display interface corresponding to the server under the condition that the target operation environment needs to be switched; receiving a target operation instruction input according to the prompt message, wherein the target operation instruction at least comprises one of the following instructions: the running command of the object code and the packaging command of the object code.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the configuration method of the operating environment when running.
According to another aspect of the embodiments of the present invention, there is also provided an electronic apparatus, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the configuration method of the execution environment through the computer program.
In the embodiment of the invention, under the condition of receiving an operation instruction corresponding to a target code, determining an operation environment to be called by the target code at a server according to the operation instruction; determining a first subfile to be executed in a configuration file corresponding to the target code according to the running environment, wherein the configuration file is used for indicating a set of variable parameters to be modified when the target code is adapted to different running environments; analyzing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining a configuration requirement for operating the target code on the server according to the target variable parameter; that is to say, by determining the operating environment of the operating instruction, then searching the corresponding subfile in the configuration file corresponding to the target code according to the operating environment, and determining the corresponding operating environment according to the subfile, by adopting the technical scheme, the problems that different configuration requirements and the like corresponding to the code cannot be efficiently determined when the code is switched between different operating environments are solved, then different configuration requirements can be automatically determined according to the operating environment, the development efficiency can be improved, and the risk of manual change errors is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a block diagram of a hardware configuration of a computer terminal that executes a configuration method of an environment according to an embodiment of the present invention;
FIG. 2 is a flow diagram of a method of configuring a runtime environment according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a method of configuring an operating environment in accordance with an alternative embodiment of the invention;
FIG. 4 is a schematic illustration of maintenance of a variable corresponding to an operating environment in accordance with an alternative embodiment of the present invention;
fig. 5 is a block diagram of a configuration apparatus of an operating environment according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the 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 invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The method provided by the embodiment of the application can be executed in a computer terminal, a computer terminal or a similar operation device. Taking the example of running on a computer terminal, fig. 1 is a hardware structure block diagram of a computer terminal of a method for configuring a running environment according to an embodiment of the present invention. As shown in fig. 1, the computer terminal may include one or more (only one shown in fig. 1) processors 102 (the processors 102 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and in an exemplary embodiment, may also include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the computer terminal. For example, the computer terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration with equivalent functionality to that shown in FIG. 1 or with more functionality than that shown in FIG. 1.
The memory 104 may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the configuration method of the operating environment in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by executing the computer programs stored in the memory 104, so as to implement the above-mentioned 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 examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to a computer terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In this embodiment, a configuration method of an operating environment is provided, and is applied to the computer terminal, and fig. 2 is a flowchart of the configuration method of the operating environment according to the embodiment of the present invention, where the flowchart includes the following steps:
step S202, under the condition that an operation instruction corresponding to a target code is received, determining an operation environment to be called of the target code at a server according to the operation instruction;
optionally, the running instruction is used to instruct to run a running environment corresponding to a function interface to be called of the current target code at the server;
step S204, determining a first subfile to be executed in a configuration file corresponding to the target code according to the operating environment, wherein the configuration file is used for indicating a set of variable parameters to be modified when the target code is adapted to different operating environments;
step S206, analyzing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining a configuration requirement for operating the target code on the server according to the target variable parameter.
Through the steps, under the condition that an operation instruction corresponding to the target code is received, determining an operation environment to be called of the target code at a server according to the operation instruction; determining a first subfile to be executed in a configuration file corresponding to the target code according to the running environment, wherein the configuration file is used for indicating a set of variable parameters to be modified when the target code is adapted to different running environments; analyzing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining a configuration requirement for operating the target code on the server according to the target variable parameter; that is to say, by determining the operating environment of the operating instruction, then searching the corresponding subfile in the configuration file corresponding to the target code according to the operating environment, and determining the corresponding operating environment according to the subfile, by adopting the technical scheme, the problems that different configuration requirements and the like corresponding to the code cannot be efficiently determined when the code is switched between different operating environments are solved, then different configuration requirements can be automatically determined according to the operating environment, the development efficiency can be improved, and the risk of manual change errors is reduced.
In an exemplary embodiment, before determining, according to the execution environment, a first subfile to be executed in a configuration file corresponding to the object code, the method further includes: acquiring basic information of an operating environment allowing the target code to be operated, wherein the basic information is used for indicating the operating requirement of the target code in the operating environment; generating a target subfile matched with the target code and the running environment according to the basic information; and combining a plurality of target subfiles to obtain a configuration file corresponding to the target code under the condition that a plurality of running environments of the target code exist at the same time.
In short, in order to ensure the adaptability of the configuration file to different operating environments, basic information of the operating environment allowing the target code to operate is acquired, an operating requirement corresponding to the operating environment is determined according to the basic information, variable parameters of the operating environment to be configured are determined according to the operating requirement, and then the variable parameters of one or more operating environments are combined to determine the configuration file corresponding to the target code.
In an exemplary embodiment, after generating a target subfile in which the target code matches the execution environment according to the basic information, the method further includes: receiving a maintenance instruction sent by a target object, wherein the maintenance instruction is used for carrying variable parameters configuring a target subfile, and the variable parameters are used for indicating a function corresponding to an updated operating environment; and modifying the target variable parameters in the target subfile according to the maintenance instruction.
It can be understood that, because the change of practical application is various, in order to guarantee the accuracy of the configuration file, the configuration file is updated according to new variable parameters, so that the expansibility of the configuration file is greatly improved, and when the configuration requirements of different operating environments are changed, the cost of modifying codes is reduced, so that the development efficiency of target codes for the operating environments is improved.
In an exemplary embodiment, when a plurality of running environments of the object code exist simultaneously, after combining a plurality of object subfiles to obtain a configuration file corresponding to the object code, the method further includes: associating a process command of the object code with the configuration file, wherein the process command includes at least one of: operating commands and packaging commands; and matching target reading operation corresponding to the processing command according to the correlation result, wherein the target reading operation is used for indicating the reading direction of the server to the information in the target code.
In an exemplary embodiment, modifying the target variable parameter in the target subfile according to the maintenance instruction includes: determining all variable parameters of the modified target subfile; and adding all the variable parameters into the global variable of the target code according to a preset rule.
For example, the environment configuration file is associated with a run or package command, such as: when the local operation is performed, the development environment configuration is directly read, when the test environment is packed, the test environment is directly read, the variables in the configuration file are added into the global variables of the codes, and the code operation can be distinguished and configured according to the global variables;
in an exemplary embodiment, determining a first subfile to be executed in a configuration file corresponding to the object code according to the execution environment includes: determining the running environment to which the target code is to be configured; and under the condition that the operating environment to be configured meets the operating conditions of the object code, determining a first subfile to be executed in a corresponding configuration file in the object code according to the operating environment, wherein the first subfile is one of a plurality of target subfiles in the configuration file.
In an exemplary embodiment, after parsing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining a configuration requirement for operating the target code on the server according to the target variable parameter, the method further includes: sending prompt information to a display interface corresponding to the server under the condition that the target operation environment needs to be switched; receiving a target operation instruction input according to the prompt message, wherein the target operation instruction at least comprises one of the following instructions: the running command of the object code and the packaging command of the object code.
Optionally, when the target operating environment corresponding to the target code is switched, a prompt message is sent to a display interface corresponding to the server to prompt the target object operating environment to change, and in order to ensure validity of the change, a new target operating instruction needs to be determined, content in the configuration file needs to be read when the new target operating instruction is executed, and after the maintained variable is mounted as a global variable, configuration of different environments is distinguished according to the corresponding updated global variable when the new target operating instruction is used for operating.
In order to better understand the process of the configuration method of the above operating environment, the following describes an implementation method flow of the configuration of the above operating environment with reference to an optional embodiment, but the implementation method flow is not limited to the technical solution of the embodiment of the present invention.
The embodiment provides a front-end environment configuration management method, and provides a front-end environment configuration management scheme, wherein a configuration file is maintained for each set of operating environment independently, the configuration file is associated with a code operating or packaging command, and environment information in the corresponding configuration file is read before the code operates or is packaged, so that the requirement of automatically switching environment configuration can be met.
As an alternative implementation, for example, in a development environment, different environment interfaces of a server may be called, and meanwhile, a log needs to be output, a cross-domain problem is handled through a local proxy, and the like, and then a parameter of a corresponding configuration file is used to indicate operations such as outputting the log, handling the cross-domain problem through the local proxy, and the like. And under the test environment, a test environment interface of the server is called, and meanwhile, logs are required to be output, so that the cross-domain problem is not processed through a local agent. And in the production environment, calling a production environment interface of the server, deleting the log, reporting the dotting, and no longer processing the cross-domain problem through the local agent, wherein the parameters of the corresponding configuration file are used for indicating the operations of reporting the dotting and the like.
Fig. 3 is a schematic diagram of a configuration method of an operating environment according to an alternative embodiment of the present invention, as shown in fig. 3, the following steps are specifically performed:
step S302: the system is characterized in that a plurality of code running environments are counted, and the code running environments are divided into a development environment, a test environment and a production environment;
step S304: counting variables needing to be distinguished in the environment configuration, such as whether a log is displayed or not, whether a point needs to be buried or not, an interface domain name and the like or not;
step S306: designing a configuration file for each set of environment, wherein all the variables are maintained, and different parameters are configured according to the requirements of each environment, such as display logs, non-buried points and test interfaces in a test environment;
step S308: the environment configuration file is associated with an operation or packaging command, for example, when the environment is locally operated, the development environment configuration is directly read, when the test environment is packaged, the test environment is directly read, variables in the configuration file are added into global variables of the codes, and the codes can be distinguished and configured when the codes are operated according to the global variables;
it should be noted that, if there are other environment configuration requirements in the following, only the new variables need to be added to the configuration file.
Optionally, fig. 4 is a schematic diagram of maintenance of corresponding variables of an operating environment according to an alternative embodiment of the invention; comprises the following steps:
step one, determining an operation command;
determining a configuration file associated with the operation command or the code packaging command, wherein the configuration file is used for indicating a file separately maintained for each operation environment, and variables used for distinguishing the environments among different operation environments are maintained in the configuration file;
reading the content in the configuration file when executing the command, and mounting the maintained variable as a global variable;
fourthly, distinguishing the configuration of different environments according to the corresponding global variables when the code runs;
it should be noted that, by using the above variable maintenance method, only the commands of different environments need to be executed when different environments are switched, and the environment variables do not need to be modified manually in advance.
In summary, through an alternative embodiment of the present invention, a front-end environment configuration management scheme is utilized that maintains corresponding variables by maintaining configuration files for the operating environment. The environmental configuration does not need to be manually changed in advance, the development efficiency is high, and the error risk is low. The expansibility is high, and only new configuration files or environment variables are required to be added in the existing configuration files when new configuration requirements exist.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a configuration device of an operating environment is further provided, and the configuration device is used to implement the foregoing embodiments and preferred embodiments, and details of which have been already described are omitted. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
FIG. 5 is a block diagram of a configuration device of an operating environment according to an embodiment of the present invention; as shown in fig. 5, includes:
the first determining module 52 is configured to, when an operation instruction corresponding to an object code is received, determine, according to the operation instruction, an operation environment to be called by the object code at a server;
a second determining module 54, configured to determine, according to the operating environment, a first subfile to be executed in a configuration file corresponding to the target code, where the configuration file is used to indicate a set of variable parameters to be modified when the target code is adapted to different operating environments;
and the calling module 56 is configured to analyze the first subfile, determine a target variable parameter corresponding to the operating environment, and determine a configuration requirement for operating the target code on the server according to the target variable parameter.
By the device, under the condition of receiving an operation instruction corresponding to the target code, the operation environment to be called of the target code at the server side is determined according to the operation instruction; determining a first subfile to be executed in a configuration file corresponding to the target code according to the running environment, wherein the configuration file is used for indicating a set of variable parameters to be modified when the target code is adapted to different running environments; analyzing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining a configuration requirement for operating the target code on the server according to the target variable parameter; that is to say, by determining the operating environment of the operating instruction, then searching the corresponding subfile in the configuration file corresponding to the target code according to the operating environment, and determining the corresponding operating environment according to the subfile, by adopting the technical scheme, the problems that different configuration requirements and the like corresponding to the code cannot be efficiently determined when the code is switched between different operating environments are solved, then different configuration requirements can be automatically determined according to the operating environment, the development efficiency can be improved, and the risk of manual change errors is reduced.
In an exemplary embodiment, the apparatus further includes: the acquisition module is used for acquiring basic information of an operating environment allowing the target code to operate, wherein the basic information is used for indicating the operating requirement of the target code in the operating environment; generating a target subfile matched with the target code and the running environment according to the basic information; and combining a plurality of target subfiles to obtain a configuration file corresponding to the target code under the condition that a plurality of running environments of the target code exist at the same time. In short, in order to ensure the adaptability of the configuration file to different operating environments, basic information of the operating environment allowing the target code to operate is acquired, an operating requirement corresponding to the operating environment is determined according to the basic information, variable parameters of the operating environment to be configured are determined according to the operating requirement, and then the variable parameters of one or more operating environments are combined to determine the configuration file corresponding to the target code.
In an exemplary embodiment, the obtaining module further includes: the system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a maintenance instruction sent by a target object, the maintenance instruction is used for carrying variable parameters configuring a target subfile, and the variable parameters are used for indicating a function corresponding to an updated operating environment; and modifying the target variable parameters in the target subfile according to the maintenance instruction. It can be understood that, because the change of practical application is various, in order to guarantee the accuracy of the configuration file, the configuration file is updated according to new variable parameters, so that the expansibility of the configuration file is greatly improved, and when the configuration requirements of different operating environments are changed, the cost of modifying codes is reduced, so that the development efficiency of target codes for the operating environments is improved.
In an exemplary embodiment, the obtaining module further includes: a matching unit, configured to associate a processing command of the target code with the configuration file, wherein the processing command includes at least one of: operating commands and packaging commands; and matching target reading operation corresponding to the processing command according to the correlation result, wherein the target reading operation is used for indicating the reading direction of the server to the information in the target code.
In an exemplary embodiment, the receiving unit is further configured to determine all variable parameters of the modified target subfile; and adding all the variable parameters into the global variable of the target code according to a preset rule. For example, the environment configuration file is associated with a run or package command, for example, when the environment configuration file is locally run, the development environment configuration is directly read, when the test environment is packaged, the test environment is directly read, the variables in the configuration file are added as global variables of the code, and the code can be distinguished and configured during the run according to the global variables.
In an exemplary embodiment, the invoking module is further configured to determine that the execution environment determines an execution environment to be configured for the target code; and under the condition that the operating environment to be configured meets the operating conditions of the object code, determining a first subfile to be executed in a corresponding configuration file in the object code according to the operating environment, wherein the first subfile is one of a plurality of target subfiles in the configuration file.
In an exemplary embodiment, the apparatus further includes: the prompt module is used for sending prompt information to a display interface corresponding to the server under the condition that the target operation environment needs to be switched; receiving a target operation instruction input according to the prompt message, wherein the target operation instruction at least comprises one of the following instructions: the running command of the object code and the packaging command of the object code.
Optionally, when the target operating environment corresponding to the target code is switched, a prompt message is sent to a display interface corresponding to the server to prompt the target object operating environment to change, and in order to ensure validity of the change, a new target operating instruction needs to be determined, content in the configuration file needs to be read when the new target operating instruction is executed, and after the maintained variable is mounted as a global variable, configuration of different environments is distinguished according to the corresponding updated global variable when the new target operating instruction is used for operating.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
An embodiment of the present invention further provides a storage medium including a stored program, wherein the program executes any one of the methods described above.
Alternatively, in the present embodiment, the storage medium may be configured to store program codes for performing the following steps:
s1, under the condition that an operation instruction corresponding to the target code is received, determining an operation environment to be called by the target code at a server according to the operation instruction;
s2, determining a first subfile to be executed in a configuration file corresponding to the target code according to the operating environment, wherein the configuration file is used for indicating a set of variable parameters to be modified when the target code is adapted to different operating environments;
s3, analyzing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining a configuration requirement for operating the target code on the server according to the target variable parameter.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, under the condition that an operation instruction corresponding to the target code is received, determining an operation environment to be called by the target code at a server according to the operation instruction;
s2, determining a first subfile to be executed in a configuration file corresponding to the target code according to the operating environment, wherein the configuration file is used for indicating a set of variable parameters to be modified when the target code is adapted to different operating environments;
s3, analyzing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining a configuration requirement for operating the target code on the server according to the target variable parameter.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing program codes, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method for configuring an operating environment, comprising:
under the condition of receiving an operation instruction corresponding to a target code, determining an operation environment to be called at a server side of the target code according to the operation instruction;
determining a first subfile to be executed in a configuration file corresponding to the target code according to the running environment, wherein the configuration file is used for indicating a set of variable parameters to be modified when the target code is adapted to different running environments;
and analyzing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining a configuration requirement for operating the target code on the server according to the target variable parameter.
2. The method according to claim 1, wherein before determining the first subfile to be executed in the configuration file corresponding to the object code according to the runtime environment, the method further comprises:
acquiring basic information of an operating environment allowing the target code to be operated, wherein the basic information is used for indicating the operating requirement of the target code in the operating environment;
generating a target subfile matched with the target code and the running environment according to the basic information;
and combining a plurality of target subfiles to obtain a configuration file corresponding to the target code under the condition that a plurality of running environments of the target code exist at the same time.
3. The method for configuring the runtime environment according to claim 2, wherein after generating a target subfile in which the target code matches the runtime environment according to the basic information, the method further comprises:
receiving a maintenance instruction sent by a target object, wherein the maintenance instruction is used for carrying variable parameters configuring a target subfile, and the variable parameters are used for indicating a function corresponding to an updated operating environment;
and modifying the target variable parameters in the target subfile according to the maintenance instruction.
4. The method according to claim 2, wherein when there are a plurality of runtime environments of the object code at the same time, after combining a plurality of the object subfiles to obtain a configuration file corresponding to the object code, the method further comprises:
associating a process command of the object code with the configuration file, wherein the process command includes at least one of: operating commands and packaging commands;
and matching target reading operation corresponding to the processing command according to the correlation result, wherein the target reading operation is used for indicating the reading direction of the server to the information in the target code.
5. The method for configuring the runtime environment according to claim 3, wherein modifying the target variable parameter in the target subfile according to the maintenance instruction comprises:
determining all variable parameters of the modified target subfile;
and adding all the variable parameters into the global variable of the target code according to a preset rule.
6. The method for configuring the execution environment according to claim 1, wherein determining the first subfile to be executed in the configuration file corresponding to the object code according to the execution environment comprises:
determining the running environment to which the target code is to be configured;
and under the condition that the operating environment to be configured meets the operating conditions of the object code, determining a first subfile to be executed in a corresponding configuration file in the object code according to the operating environment, wherein the first subfile is one of a plurality of target subfiles in the configuration file.
7. The method according to claim 1, wherein after parsing the first subfile and determining a target variable parameter corresponding to the operating environment to determine a configuration requirement for operating the target code on the server according to the target variable parameter, the method further comprises:
sending prompt information to a display interface corresponding to the server under the condition that the target operation environment needs to be switched;
receiving a target operation instruction input according to the prompt message, wherein the target operation instruction at least comprises one of the following instructions: the running command of the object code and the packaging command of the object code.
8. An apparatus for configuring an operating environment, comprising:
the first determining module is used for determining the operating environment to be called of the target code at the server according to the operating instruction under the condition that the operating instruction corresponding to the target code is received;
a second determining module, configured to determine, according to the operating environment, a first subfile to be executed in a configuration file corresponding to the target code, where the configuration file is used to indicate a set of variable parameters to be modified when the target code is adapted to different operating environments;
and the calling module is used for analyzing the first subfile, determining a target variable parameter corresponding to the operating environment, and determining the configuration requirement for operating the target code on the server according to the target variable parameter.
9. A computer-readable storage medium, comprising a stored program, wherein the program is operable to perform the method of any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 7 by means of the computer program.
CN202111249327.9A 2021-10-26 2021-10-26 Method and device for configuring operating environment, storage medium and electronic device Pending CN114090074A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111249327.9A CN114090074A (en) 2021-10-26 2021-10-26 Method and device for configuring operating environment, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111249327.9A CN114090074A (en) 2021-10-26 2021-10-26 Method and device for configuring operating environment, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN114090074A true CN114090074A (en) 2022-02-25

Family

ID=80297727

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111249327.9A Pending CN114090074A (en) 2021-10-26 2021-10-26 Method and device for configuring operating environment, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN114090074A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114826899A (en) * 2022-03-16 2022-07-29 青岛海尔科技有限公司 Debugging method and device of equipment control service, storage medium and electronic device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114826899A (en) * 2022-03-16 2022-07-29 青岛海尔科技有限公司 Debugging method and device of equipment control service, storage medium and electronic device
CN114826899B (en) * 2022-03-16 2024-01-23 青岛海尔科技有限公司 Debugging method and device for equipment control service, storage medium and electronic device

Similar Documents

Publication Publication Date Title
CN113010378B (en) Log processing method and device of microservice module, storage medium and electronic device
CN112035344A (en) Multi-scenario test method, device, equipment and computer readable storage medium
CN111736938B (en) Information display method and device, storage medium and electronic device
CN112632420A (en) Interface skipping method and device, storage medium and electronic device
CN112269746A (en) Automatic testing method and related equipment
CN111552484A (en) Application package distribution method, device, equipment and storage medium
CN114090074A (en) Method and device for configuring operating environment, storage medium and electronic device
CN111177243A (en) Data export method and device, storage medium and electronic device
CN110569129A (en) Resource allocation method and device, storage medium and electronic device
CN113014626B (en) Data service management method and device, storage medium and electronic device
CN113495765A (en) Business data filling method and device, storage medium and electronic device
CN111832273A (en) Method and device for determining destination message, storage medium and electronic device
CN114253441B (en) Method and device for enabling target function, storage medium and electronic device
CN113934552A (en) Method and device for determining function code, storage medium and electronic device
CN115511060A (en) Model conversion method, device, storage medium and electronic device
CN113900937A (en) Script calling method and device, electronic device and storage medium
CN115878443A (en) Interface test script generation method and device, storage medium and electronic device
CN110580172B (en) Configuration rule verification method and device, storage medium and electronic device
CN112698948A (en) Method and device for acquiring product resources, storage medium and electronic device
CN113110991A (en) Page element positioning method and device, storage medium and electronic device
CN111427603A (en) Application program upgrading method and device
CN110647546A (en) Third-party rule engine generation method and device
CN109669699A (en) Application program distribution method, AC, AP and Radio Network System
CN116737626B (en) HCA card control method, system, device, storage medium and electronic device
CN117234914A (en) AB test method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination