CN111767089A - Method, device and equipment for loading file and storage medium - Google Patents

Method, device and equipment for loading file and storage medium Download PDF

Info

Publication number
CN111767089A
CN111767089A CN202010599858.XA CN202010599858A CN111767089A CN 111767089 A CN111767089 A CN 111767089A CN 202010599858 A CN202010599858 A CN 202010599858A CN 111767089 A CN111767089 A CN 111767089A
Authority
CN
China
Prior art keywords
request
environment variable
parameter
variable
configuration file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010599858.XA
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.)
Apollo Zhilian Beijing Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202010599858.XA priority Critical patent/CN111767089A/en
Publication of CN111767089A publication Critical patent/CN111767089A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Abstract

The application discloses a method, a device, equipment and a storage medium for loading files, and relates to the fields of internet, cloud computing, software development, code deployment and the like. The specific implementation scheme is as follows: responding to the first request, and acquiring the running environment variable set in the webpage server; packaging the first request and the operation environment variable according to a format of a specified protocol to obtain a second request; and sending the second request to a back end so as to load a configuration file corresponding to the operation environment variable at the back end. According to the embodiment of the application, the operation environment variable is arranged in the webpage server, and the webpage server encapsulates the operation environment variable in the request and sends the operation environment variable to the back end, so that the back end can directly analyze the operation environment variable, and the configuration file corresponding to the operation environment variable can be conveniently and rapidly loaded.

Description

Method, device and equipment for loading file and storage medium
Technical Field
The application relates to the field of computers, in particular to the fields of internet, cloud computing, software development, code deployment and the like.
Background
Configuration files play a major role in software development. Much information and key values cannot be hard-coded in the code. For example, part of the information is changed according to the operating environment, and hard coding is not beneficial to project maintenance, so that the information needs to be written into a configuration file, and the corresponding configuration file is dynamically loaded according to the change of the operating environment.
The current project loads the corresponding environment configuration files in the following way:
and writing the hostname (host name) of each environment machine into a white list, judging the running environment by acquiring the hostname in the program, and reading the corresponding configuration file. Therefore, a white list needs to be maintained in the program, and machines for service deployment cannot be flexibly added or deleted.
Setting environment variables of an operating system level for machines of each operating environment, reading the environment variables from the operating system in a program, judging the operating environment, and then reading corresponding configuration files. This not only requires additional configuration, but is also inefficient.
Disclosure of Invention
The application provides a method, a device, equipment and a storage medium for loading files.
According to an aspect of the present application, there is provided a method of loading a file, including:
responding to the first request, and acquiring the running environment variable set in the webpage server;
packaging the first request and the operation environment variable according to a format of a specified protocol to obtain a second request;
and sending the second request to a back end so as to load a configuration file corresponding to the operation environment variable at the back end.
According to another aspect of the present application, there is provided a method of loading a file, including:
receiving a request including an operating environment variable from a web server;
and loading a configuration file corresponding to the operating environment variable.
According to another aspect of the present application, there is provided an apparatus for loading a file, including:
the acquisition module is used for responding to the first request and acquiring the operating environment variable set in the webpage server;
the encapsulation module is used for encapsulating the first request and the operation environment variable according to the format of a specified protocol to obtain a second request;
and the sending module is used for sending the second request to a back end so as to load the configuration file corresponding to the operation environment variable at the back end.
According to another aspect of the present application, there is provided an apparatus for loading a file, including:
the receiving module is used for receiving a request comprising the operation environment variable from the webpage server;
and the loading module is used for loading the configuration file corresponding to the running environment variable.
According to another aspect of the present application, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a method of loading a file.
According to another aspect of the present application, there is provided a non-transitory computer readable storage medium storing computer instructions for causing a computer to perform a method of loading a file.
According to the embodiment of the application, the running environment variable is arranged in the webpage server, and the webpage server encapsulates the running environment variable in the request and sends the request to the back end, so that the back end can directly analyze the running environment variable, and the configuration file corresponding to the running environment variable can be conveniently and quickly loaded.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present application, nor do they limit the scope of the present application. Other features of the present application will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
FIG. 1 is a flow diagram of a method of loading a file according to an embodiment of the present application;
FIG. 2 is a flow diagram of a method of loading a file according to another embodiment of the present application;
FIG. 3 is a flow diagram of a method of loading a file according to another embodiment of the present application;
FIG. 4 is a flow diagram of a method of loading a file according to another embodiment of the present application;
FIG. 5 is a block diagram of an apparatus for loading files according to an embodiment of the present application;
FIG. 6 is a block diagram of an apparatus for loading files according to another embodiment of the present application;
FIG. 7 is a block diagram of an apparatus for loading files according to another embodiment of the present application;
FIG. 8 is a block diagram of an apparatus for loading files according to another embodiment of the present application;
fig. 9 is a block diagram of an electronic device of a method of loading a file according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a flowchart of a method for loading a file according to an embodiment of the present application, which may be applied to a web server (WebServer), and the method may include:
s101, responding to the first request, and acquiring an operating environment variable set in a webpage server;
s102, packaging the first request and the operation environment variable according to a format of a specified protocol to obtain a second request;
s103, sending the second request to a back end so as to load a configuration file corresponding to the operation environment variable at the back end.
In this embodiment, the running environment variable may be set in the web server in advance. The operating environment variable is mainly used for indicating the operating environment supported by the web server. The runtime environment is sometimes referred to as a deployment environment. For example, the execution environment of a certain item (or service) includes a development environment, a test environment, and an online environment. The upstream service or processing of different requests of different environments may also differ when other services or data processing is invoked, which may be written in configuration files of different environments. Profiles for different environments are typically associated with a particular service and may also be referred to as service profiles. The service profile may include, but is not limited to, images, link addresses, keys, and the like.
Each web server may have its own operating environment variables. The web server receives a first request from the outside, such as a client, and then can acquire the running environment variable of the web server. The first request may be for a certain service, for example: weather, train tickets, stock, lottery tickets, etc. Then, the web server may repackage the first request and the operating environment variable of the web server itself to obtain a second request. The web server may then send the second request to the backend for processing. The backend may also be referred to as a server-side program of the backend, a backend program, and the like, and is used to parse and process the request from the web server. In one example, the web server and the backend program may be deployed on the same physical machine. The configuration file corresponding to the operating environment variable may be deployed in the physical machine local or in a remote location, such as a cloud.
And the back end analyzes the second request to obtain the operation environment variable therein, so as to load the service configuration file corresponding to the operation environment variable. For example, the weather service has business profiles of a development environment and a test environment, and if the running environment variable in the second request represents the development environment, the business profile of the weather service in the development environment is loaded.
In addition, the back end can load the service configuration file of one service, and can also load the service configuration files of a plurality of services. For example, if the operating environment variable represents a test environment, a business profile for a number of services such as weather, train tickets, stocks, lottery tickets, etc. may be loaded.
In this embodiment, because the operating environment variable is set in the web server, the web server encapsulates the operating environment variable in the request and sends the request to the back end, so that the back end can directly analyze the operating environment variable to obtain the configuration file corresponding to the operating environment variable, and the configuration file corresponding to the operating environment variable can be conveniently and quickly loaded. Compared with the white list mode, the white list does not need to be maintained, host names in the white list do not need to be compared one by one, machines for service deployment can be flexibly added or deleted, and flexibility and expandability are higher. Compared with the system-level environment variables, the method does not need to jump out the process of processing the request, and then the environment variables are read in the operating system, and other extra configuration is not needed, so that the processing efficiency is improved.
FIG. 2 is a flow diagram of a method of loading a file according to another embodiment of the present application. The method for loading the file of this embodiment may include the steps of the embodiment shown in fig. 1. In this embodiment, the first request includes a service parameter;
in S102, encapsulating the first request and the operating environment variable according to a format of a specified protocol to obtain a second request, including: s1021, according to the format of the designated protocol, packaging the service parameter and the operation environment variable to obtain the second request.
In one example, the first request may include traffic parameters required for a certain service. The webpage server analyzes the first request to obtain service parameters such as user information, an object requested to be accessed and the like. For example, if the object for which the first request is resolved to obtain the requested access is a weather service, and the name of the specific city to be queried is "beijing", it indicates that the first request needs to query the weather of beijing. The service parameters and the operating environment variables of the web server can be encapsulated according to the format of the set protocol to obtain the second request. The program at the back end can analyze the second request to obtain the service parameters and the operating environment variables. Then, the program at the back end can load the corresponding configuration file according to the service parameter and the operation environment variable, and process the service parameter by using the loaded configuration file. For example, the operating environment variable in the second request represents a development environment, and the business parameter includes "weather service" and "beijing", and after the business configuration file of the development environment is loaded by the weather service, a request for inquiring weather of "beijing" is sent to a link address of the development environment of the weather service to inquire weather conditions corresponding to the business parameter "beijing".
In this embodiment, the web server packages the service parameters of the first request and the operating environment variables together and sends the packaged service parameters and the operating environment variables to the back-end processor, and the service parameters can be processed after the configuration files corresponding to the operating environment variables are loaded, which is beneficial to simplifying the processing flow and improving the processing efficiency.
In a possible implementation manner, the method for loading the file further includes:
s201, setting the operation environment variable in a configuration file of the webpage server. After receiving the first request, the web server can read the operating environment variable from the configuration file of the web server, and encapsulate the operating environment variable in the second request to send to the back end, so that the back end can directly analyze the operating environment variable to obtain the configuration file corresponding to the operating environment variable, and the configuration file corresponding to the operating environment variable can be conveniently and quickly loaded.
In a possible implementation, the web server is a hypertext transfer Protocol (HTTP) server, the specified Protocol is a Fast common gateway Interface (FastCGI) Protocol, and in S201, the setting the running environment variable in a configuration file of the web server includes: a FastCGI variable indicating the runtime environment is added to the FastCGI configuration file of the HTTP server.
The FastCGI is a scalable and high-speed interface for communication between the HTTP server and the dynamic scripting language, and has the main advantage that the dynamic language is separated from the HTTP server, and most web servers (WebServer) support the FastCGI. FastCGI is also supported by many scripting languages, one of the more popular scripting languages being Hypertext Preprocessor (PHP). The FastCGI interface mode adopts a C/S architecture, can separate an HTTP server from a script analysis server, and simultaneously starts one or more script analysis daemon processes on the script analysis server. Each time the HTTP server encounters a dynamic program, it can be handed over directly to the FastCGI process for execution and then return the resulting structure to the browser. The method can enable the HTTP server to exclusively process the static request or return the result of the dynamic script server to the client, thereby greatly improving the performance of the whole application system.
For example, Nginx is an HTTP server that supports the FastCGI protocol. Conf file in Nginx, fastcgI variable (FastCGI param), which may be named RUNTIME _ ENVIROMENT. The FastCGI variable is used to indicate the runtime environment supported by the web server.
By configuring a FastCGI variable (FastCGI _ param) RUNTIME _ ENVIROMENT, environment distinction is realized so as to read a corresponding configuration file, the configuration file can be dynamically loaded, and the implementation method is simple and convenient and has low cost.
In one possible implementation, different operation environment variables correspond to different operation environments, the operation environment variable of the development environment is a first parameter, the operation environment variable of the test environment is a second parameter, and the operation environment variable of the online environment is a third parameter; and, the first parameter, the second parameter, and the third parameter are different.
The test environment may also be referred to as a sandbox (sandbox) environment. A sandbox environment is a security mechanism in the field of computer security, providing an isolated environment for running programs.
In the embodiment of the present application, the value of the FastCGI variable used to indicate the operating environment may be fixed for each web server, and the value of the FastCGI variable may be different for different web servers. For example, the operating environment variable is a first parameter "dev", which may represent a development environment; the operating environment variable is a third parameter "release" which can represent an online environment; the running environment variable as the second parameter "sandbox" may represent a sandbox environment. Further, similar values also need to be included in the configuration file corresponding to the FastCGI variable for indicating the execution environment. For example, including "dev" in the file name of a configuration file may indicate that the configuration file is suitable for the development environment; the inclusion of "release" in the file name may indicate that the configuration file is suitable for an online environment; the inclusion of "sandbox" in the filename may indicate that the configuration file is suitable for use in a sandbox environment. The values of the different operating environments and the naming rules of the configuration files are only examples and are not limited, and any character strings that can distinguish the different operating environments may be used. Different parameters are set for different operation environment variables, so that configuration files of different operation environments can be distinguished, and the appropriate configuration files can be loaded conveniently.
FIG. 3 is a flow diagram of a method of loading a file according to another embodiment of the present application. The method for loading the file can be applied to a back end, which can also be called a back end server program or a back end program, and is used for analyzing and processing the request from the web server. The method for loading the file can comprise the following steps:
s301, receiving a request including an operation environment variable from a webpage server;
and S302, loading a configuration file corresponding to the operating environment variable.
In this embodiment, the request including the operating environment variable from the web server may be as described in relation to the second request in fig. 1 and 2. Moreover, the same descriptions of the present embodiment and the previous embodiments have the same meanings, and are not repeated herein.
In this embodiment, each web server may have its own operating environment variable. The web server receives a first request from the outside, such as a client, and then can acquire the running environment variable of the web server. Then, the web server may repackage the first request and the operating environment variable of the web server itself to obtain a second request. The web server may then send the second request to the backend for processing. And the back end analyzes the second request to obtain the operation environment variable therein, so as to load the service configuration file corresponding to the operation environment variable.
In this embodiment, since the running environment variable is set in the web server, after the back end receives the request including the running environment variable from the web server, the back end can directly analyze the running environment variable to obtain the running environment variable, and the configuration file corresponding to the running environment variable can be conveniently and quickly loaded.
FIG. 4 is a flow diagram of a method of loading a file according to another embodiment of the present application. The method for loading the file of this embodiment may include the steps of the embodiment shown in fig. 3. In this embodiment, the method for loading a file further includes:
s401, in the hypertext preprocessor (PHP), the running environment variable is obtained by using the environment variable obtaining function. PHP is a general open source scripting language. PHP is a scripting language that can be executed on the server side, similar to C, and is a commonly used web site programming language.
After executing S301, the backend may parse the received request including the operating environment variable to obtain the operating environment variable therein. For example, the runtime environment variable is obtained with getenv () function in PHP. Therefore, the back end can conveniently and quickly acquire the operating environment variable.
In one possible implementation, different operation environment variables correspond to different operation environments, the operation environment variable of the development environment is a first parameter, the operation environment variable of the test environment is a second parameter, and the operation environment variable of the online environment is a third parameter; and the first parameter, the second parameter, and the third parameter are different.
In a possible implementation manner, the request further includes a service parameter, and the method for loading a file further includes: s402, processing the service parameters by using the loaded configuration file. Specifically, the manner in which the backend processes the service parameters by using the loaded configuration file may refer to the related description of the embodiments in fig. 1 and fig. 2, which is not described herein again. After the configuration file corresponding to the operating environment variable is loaded, the service parameters can be directly processed, so that the processing flow is simplified, and the processing efficiency is improved.
In an application example, the embodiment of the present application provides a method for dynamically loading a configuration file by configuring a FastCGI variable FastCGI _ param. In a Web page (Web) request, the request first reaches a Web server (taking Nginx as an example). The Nginx will encapsulate the request data via the FastCGI protocol and add the configuration information that has been predefined and then pass it to the backend program. Based on the above principle, the developer only needs to configure one fastcgi _ param in nginnx as the identifier of the operating environment, read the relevant identifier in the program at the back end, and then read the configuration file corresponding to the identifier.
In this example, a web server (WebServer) takes Nginx as an example, a server programming language takes PHP as an example, and the basic flow is as follows:
a FastCGI configuration (see the partial code example of the FastCGI. conf file below) is added to the FastCGI. conf file of Nginx, indicating that the user defines a FastCGI variable named RUNTIME _ entry.
Conf file is an example of part code as follows:
Figure BDA0002558772740000081
Figure BDA0002558772740000091
referring to the above example of the profile code, the value of the FastCGI variable RUNTIME _ ENVIROMENT may be fixed for each web server, and the value of the RUNTIME _ ENVIROMENT may be different for different web servers. In the above example, the running _ entry is "dev" and may represent a development environment.
Furthermore, the statement "release" in the above example may represent an online context. "sandbox" may represent a sandbox environment. The values of the different execution environments described above are merely examples and are not limiting, and the values used to distinguish the different execution environments may be any string defined by a user.
After a FastCGI configuration (including the FastCGI variable named RUNTIME _ entry) is added to a FastCGI. conf file of Nginx, the Nginx may be restarted, causing the Nginx to load the newly added FastCGI configuration.
When a first request of a user, such as an HTTP request, reaches nginnx, nginnx parses the request, for example, parses service parameters, such as time, people, location, and requirement, included in the request. Then, Nginx encapsulates these service parameters according to the FastCGI protocol, and fills the relevant FastCGI variables in the encapsulated request. For example, the value of fastcgi _ param RUNTIME _ ENVIROMENT in the request is set to "sandbox". And then sending the encapsulated request to a server program at the back end for logic processing.
The server program at the back end can read the relevant FastCGI variable, whether originally supported by the FastCGI protocol or customized by the user. For example, the PHP may use getenv ("RUNTIME _ RUNTIME") to obtain the value of the relevant RUNTIME variable, then read the configuration file of the corresponding RUNTIME environment according to the value of the RUNTIME variable (see the following example of the configuration file of the RUNTIME environment), and then complete the logic processing according to the information in the configuration file.
The following are examples of profiles for the runtime environment:
Figure BDA0002558772740000092
Figure BDA0002558772740000101
illustratively, the developer can make corresponding configurations in various environments:
an online environment: fastcgi _ param RUNTIME _ ENVIROMENT release;
a sandbox environment: fastcgi _ param RUNTIME _ ENVIROMENT sandbox;
and (3) developing environment: fastcgi _ param RUNTIME _ ENVIROMENT dev;
when service expansion or increased deployment is needed, only one new fastcgi _ param configuration is added in the WebServer, which is very convenient and fast.
In the embodiment of the application, the configuration file is dynamically loaded by the method of configuring the fastcgi _ param, so that the environment can be distinguished at the lowest cost and the corresponding configuration file can be read, only a simple configuration instruction is needed, and the method is simple to implement and has excellent performance. For example, if the same code is deployed in three environments, the scheme of the embodiment of the present application can clearly distinguish which configuration file should be read, and can support not only the program on the line to read the configuration file on the line, but also the program in the test environment to read the configuration file for the test.
FIG. 5 is a block diagram of an apparatus for loading a file according to an embodiment of the present application. The apparatus may be applied to a web server, and the apparatus may include:
an obtaining module 41, configured to, in response to the first request, obtain an operating environment variable set in the web server;
an encapsulating module 42, configured to encapsulate the first request and the operating environment variable according to a format of a specified protocol to obtain a second request;
a sending module 43, configured to send the second request to the backend, so as to load the configuration file corresponding to the operating environment variable at the backend.
In a possible embodiment, the first request includes a service parameter;
the encapsulating module 42 is specifically configured to encapsulate the service parameter and the operating environment variable according to a format of a specified protocol to obtain the second request.
In a possible embodiment, as shown in fig. 6, the apparatus further comprises:
a setting module 44, configured to set the operating environment variable in the configuration file of the web server.
In a possible embodiment, the web server is a HTTP server, the specified protocol is a fast common gateway interface, FastCGI, protocol, and the setting module is specifically configured to add a FastCGI variable indicating an operating environment to a FastCGI configuration file of the HTTP server.
In one possible implementation, different operation environment variables correspond to different operation environments, the operation environment variable of the development environment is a first parameter, the operation environment variable of the test environment is a second parameter, and the operation environment variable of the online environment is a third parameter;
and, the first parameter, the second parameter, and the third parameter are different.
FIG. 7 is a block diagram of an apparatus for loading files according to an embodiment of the present application. The apparatus may be applied to a backend, and the apparatus may include:
a receiving module 51, configured to receive a request including an operating environment variable from a web server;
and a loading module 52, configured to load a configuration file corresponding to the operating environment variable.
In a possible embodiment, as shown in fig. 8, the apparatus further comprises:
an obtaining module 53, configured to obtain the running environment variable by using an environment variable obtaining function in the hypertext preprocessor PHP.
In a possible implementation, the request further includes a service parameter, and the apparatus further includes: and the processing module 54 is configured to process the service parameter by using the loaded configuration file.
The functions of each module in each apparatus in the embodiment of the present application may refer to corresponding descriptions in the above method, and are not described herein again.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
Fig. 9 is a block diagram of an electronic device according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 9, the electronic apparatus includes: one or more processors 901, memory 902, and interfaces for connecting the various components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). Fig. 9 illustrates an example of a processor 901.
Memory 902 is a non-transitory computer readable storage medium as provided herein. The memory stores instructions executable by at least one processor, so that the at least one processor executes the method for loading files provided by the application. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the method of loading files provided herein.
The memory 902, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the method for loading files in the embodiments of the present application (for example, the obtaining module 41, the packaging module 42, and the sending module 43 shown in fig. 5, and further, the receiving module 41, and the loading module 42 shown in fig. 7). The processor 901 executes various functional applications of the server and data processing, i.e., a method of loading a file in the above-described method embodiment, by executing a non-transitory software program, instructions, and modules stored in the memory 902.
The memory 902 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device by the method of loading the file, and the like. Further, the memory 902 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 902 may optionally include a memory remotely located from the processor 901, and these remote memories may be connected to the electronic device of the method of loading files via 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 electronic device of the method of loading a file may further include: an input device 903 and an output device 904. The processor 901, the memory 902, the input device 903 and the output device 904 may be connected by a bus or other means, and fig. 9 illustrates the connection by a bus as an example.
The input device 903 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic apparatus of the method of loading a file, such as an input device of a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, etc. The output devices 904 may include a display device, auxiliary lighting devices (e.g., LEDs), tactile feedback devices (e.g., vibrating motors), and the like. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and Virtual Private Server (VPS) service.
In the embodiment of the application, the running environment variable is arranged in the webpage server, and the webpage server encapsulates the running environment variable in the request and sends the request to the back end, so that the back end can directly analyze the running environment variable, and the configuration file corresponding to the running environment variable can be conveniently and quickly loaded.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application can be achieved.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (18)

1. A method of loading a file, comprising:
responding to the first request, and acquiring an operating environment variable set in the webpage server;
packaging the first request and the operation environment variable according to a format of a specified protocol to obtain a second request;
and sending the second request to a back end so as to load a configuration file corresponding to the operation environment variable at the back end.
2. The method of claim 1, wherein the first request includes a traffic parameter;
encapsulating the first request and the operating environment variable according to a format of a specified protocol to obtain a second request, wherein the method comprises the following steps: and encapsulating the service parameters and the operation environment variables according to a format of a specified protocol to obtain the second request.
3. The method of claim 1, further comprising:
and setting the operation environment variable in a configuration file of the webpage server.
4. The method according to claim 3, wherein the web server is a hypertext transfer protocol (HTTP) server, the specified protocol is a high-speed common gateway interface (FastCGI) protocol, and setting the operating environment variables in a configuration file of the web server comprises:
a FastCGI variable indicating the runtime environment is added to the FastCGI configuration file of the HTTP server.
5. The method according to any one of claims 1 to 4, wherein different operating environment variables correspond to different operating environments, the operating environment variable of the development environment is a first parameter, the operating environment variable of the test environment is a second parameter, and the operating environment variable of the on-line environment is a third parameter;
and the first parameter, the second parameter, and the third parameter are different.
6. A method of loading a file, comprising:
receiving a request including an operating environment variable from a web server;
and loading a configuration file corresponding to the operating environment variable.
7. The method of claim 6, further comprising:
in the hypertext preprocessor PHP, the operating environment variable is acquired by using an environment variable acquisition function.
8. The method of claim 6 or 7, wherein the request further includes traffic parameters, the method further comprising:
and processing the service parameters by using the loaded configuration file.
9. An apparatus for loading a file, comprising:
the acquisition module is used for responding to the first request and acquiring the operating environment variable set in the webpage server;
the encapsulation module is used for encapsulating the first request and the operation environment variable according to a format of a specified protocol to obtain a second request;
and the sending module is used for sending the second request to a back end so as to load a configuration file corresponding to the operation environment variable at the back end.
10. The apparatus of claim 9, wherein the first request includes a traffic parameter;
the encapsulation module is specifically configured to encapsulate the service parameter and the operating environment variable according to a format of a specified protocol, so as to obtain the second request.
11. The apparatus of claim 9, further comprising:
and the setting module is used for setting the operation environment variable in the configuration file of the webpage server.
12. The apparatus according to claim 11, wherein the web server is a HTTP server, the specified protocol is a fast common gateway interface, FastCGI, protocol, and the setting module is specifically configured to add a FastCGI variable indicating an operating environment in a FastCGI configuration file of the HTTP server.
13. The apparatus according to any one of claims 9 to 12, wherein the different operation environment variables correspond to different operation environments, the operation environment variable of the development environment is a first parameter, the operation environment variable of the test environment is a second parameter, and the operation environment variable of the on-line environment is a third parameter;
and the first parameter, the second parameter, and the third parameter are different.
14. An apparatus for loading a file, comprising:
the receiving module is used for receiving a request comprising the operation environment variable from the webpage server;
and the loading module is used for loading the configuration file corresponding to the operation environment variable.
15. The apparatus of claim 14, further comprising:
and the acquisition module is used for acquiring the running environment variable by using an environment variable acquisition function in the PHP.
16. The apparatus according to claim 14 or 15, wherein the request further includes a traffic parameter, the apparatus further comprising:
and the processing module is used for processing the service parameters by utilizing the loaded configuration file.
17. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
18. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-8.
CN202010599858.XA 2020-06-28 2020-06-28 Method, device and equipment for loading file and storage medium Pending CN111767089A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010599858.XA CN111767089A (en) 2020-06-28 2020-06-28 Method, device and equipment for loading file and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010599858.XA CN111767089A (en) 2020-06-28 2020-06-28 Method, device and equipment for loading file and storage medium

Publications (1)

Publication Number Publication Date
CN111767089A true CN111767089A (en) 2020-10-13

Family

ID=72722494

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010599858.XA Pending CN111767089A (en) 2020-06-28 2020-06-28 Method, device and equipment for loading file and storage medium

Country Status (1)

Country Link
CN (1) CN111767089A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112486389A (en) * 2020-11-30 2021-03-12 维沃移动通信有限公司 Configuration file uploading method and device
CN112860450A (en) * 2020-12-04 2021-05-28 武汉悦学帮网络技术有限公司 Request processing method and device
CN113204689A (en) * 2021-05-25 2021-08-03 深圳物讯科技有限公司 Web front-end visual packaging deployment method and related products
CN116522036A (en) * 2023-07-04 2023-08-01 北京智麟科技有限公司 Environment variable construction method based on multi-party information summarized at webpage end
CN112860450B (en) * 2020-12-04 2024-04-19 武汉悦学帮网络技术有限公司 Request processing method and device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050044132A1 (en) * 2003-08-18 2005-02-24 Campbell Bill F. Web server system and method
CN103338233A (en) * 2013-06-05 2013-10-02 新浪网技术(中国)有限公司 Load balancing device, Web server, request information processing method and system
US20160085666A1 (en) * 2014-09-22 2016-03-24 International Business Machines Corporation Auto-deployment and testing of system application test cases in remote server environments
CN105630522A (en) * 2014-10-31 2016-06-01 阿里巴巴集团控股有限公司 Web application updating method, apparatus and system
CN106897053A (en) * 2016-07-08 2017-06-27 阿里巴巴集团控股有限公司 A kind of code dissemination method and device
CN109086069A (en) * 2018-10-24 2018-12-25 特瓦特能源科技有限公司 A kind of background service seamless upgrade method and device thereof
US20190213014A1 (en) * 2017-02-22 2019-07-11 Baidu Online Network Technology (Beijing) Co., Ltd Method and apparatus for loading kernel module
CN110569085A (en) * 2019-08-15 2019-12-13 上海易点时空网络有限公司 configuration file loading method and system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050044132A1 (en) * 2003-08-18 2005-02-24 Campbell Bill F. Web server system and method
CN103338233A (en) * 2013-06-05 2013-10-02 新浪网技术(中国)有限公司 Load balancing device, Web server, request information processing method and system
US20160085666A1 (en) * 2014-09-22 2016-03-24 International Business Machines Corporation Auto-deployment and testing of system application test cases in remote server environments
CN105630522A (en) * 2014-10-31 2016-06-01 阿里巴巴集团控股有限公司 Web application updating method, apparatus and system
CN106897053A (en) * 2016-07-08 2017-06-27 阿里巴巴集团控股有限公司 A kind of code dissemination method and device
US20190213014A1 (en) * 2017-02-22 2019-07-11 Baidu Online Network Technology (Beijing) Co., Ltd Method and apparatus for loading kernel module
CN109086069A (en) * 2018-10-24 2018-12-25 特瓦特能源科技有限公司 A kind of background service seamless upgrade method and device thereof
CN110569085A (en) * 2019-08-15 2019-12-13 上海易点时空网络有限公司 configuration file loading method and system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112486389A (en) * 2020-11-30 2021-03-12 维沃移动通信有限公司 Configuration file uploading method and device
CN112860450A (en) * 2020-12-04 2021-05-28 武汉悦学帮网络技术有限公司 Request processing method and device
CN112860450B (en) * 2020-12-04 2024-04-19 武汉悦学帮网络技术有限公司 Request processing method and device
CN113204689A (en) * 2021-05-25 2021-08-03 深圳物讯科技有限公司 Web front-end visual packaging deployment method and related products
CN116522036A (en) * 2023-07-04 2023-08-01 北京智麟科技有限公司 Environment variable construction method based on multi-party information summarized at webpage end
CN116522036B (en) * 2023-07-04 2023-08-29 北京智麟科技有限公司 Environment variable construction method based on multi-party information summarized at webpage end

Similar Documents

Publication Publication Date Title
US11461111B2 (en) Method for running applets, and electronic device
US11445008B2 (en) Data processing methods, electronic devices, and storage media
CN111767089A (en) Method, device and equipment for loading file and storage medium
US9590859B2 (en) Discovering resources of a distributed computing environment
CN111666585A (en) Method and device for accessing sub-application, electronic equipment and readable storage medium
CN111767069A (en) Applet processing method, server, device and storage medium
CN109672722B (en) Data deployment method and device, computer storage medium and electronic equipment
CN103092599A (en) Software develop kit
CN113050940A (en) Method for previewing small program, related device and computer program product
CN112015468A (en) Interface document processing method and device, electronic equipment and storage medium
CN113254043A (en) Web front-end project processing method and device, electronic equipment and storage medium
CN116257320B (en) DPU-based virtualization configuration management method, device, equipment and medium
CN112379951A (en) Service interface access method, device, electronic equipment and medium
CN113761412A (en) Application page display method and device, electronic equipment, medium and application system
CN111966877A (en) Front-end service method, device, equipment and storage medium
US20200401336A1 (en) Dynamic api allocation based on data-tagging
CN114661274A (en) Method and device for generating intelligent contract
CN112579096B (en) Method, device, equipment and medium for compiling and loading applet startup file
CN112379885B (en) Applet compiling method, device, equipment and readable storage medium
CN114741294A (en) Page debugging method, device, equipment and storage medium
CN111880778A (en) Interface document generation method and device, electronic equipment and storage medium
US11689630B2 (en) Request processing method and apparatus, electronic device, and computer storage medium
CN111506787A (en) Webpage updating method and device, electronic equipment and computer-readable storage medium
CN111614494B (en) Network resource simulation method and device, electronic equipment and computer readable storage medium
US11822555B2 (en) Signaling and resolution model for multi-level session-based description descriptors

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
TA01 Transfer of patent application right

Effective date of registration: 20211020

Address after: 100176 Room 101, 1st floor, building 1, yard 7, Ruihe West 2nd Road, economic and Technological Development Zone, Daxing District, Beijing

Applicant after: Apollo Zhilian (Beijing) Technology Co.,Ltd.

Address before: 2 / F, baidu building, 10 Shangdi 10th Street, Haidian District, Beijing 100085

Applicant before: BEIJING BAIDU NETCOM SCIENCE AND TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right