CN109976828B - Method and device for configuring file - Google Patents

Method and device for configuring file Download PDF

Info

Publication number
CN109976828B
CN109976828B CN201910185358.9A CN201910185358A CN109976828B CN 109976828 B CN109976828 B CN 109976828B CN 201910185358 A CN201910185358 A CN 201910185358A CN 109976828 B CN109976828 B CN 109976828B
Authority
CN
China
Prior art keywords
file
parameters
parameter
modified
storage position
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.)
Active
Application number
CN201910185358.9A
Other languages
Chinese (zh)
Other versions
CN109976828A (en
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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century 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 QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201910185358.9A priority Critical patent/CN109976828B/en
Publication of CN109976828A publication Critical patent/CN109976828A/en
Application granted granted Critical
Publication of CN109976828B publication Critical patent/CN109976828B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Abstract

The embodiment of the invention provides a method and a device for configuring files, wherein the method comprises the following steps: when a file to be configured of a service to be configured needs to be configured, acquiring a reference file corresponding to the file to be configured; detecting whether a target file matched with the reference file exists in a pre-stored position; if the target file matched with the reference file does not exist in the pre-storage position, judging whether a parameter matched with the parameter of the reference file is stored in the pre-storage position, and if so, acquiring the parameter matched with the parameter of the reference file from the pre-storage position; and adding the parameters matched with the parameters of the reference file into the file to be configured to complete the parameter configuration of the file to be configured, and taking the file to be configured after the parameters are added as a target file. Therefore, the configuration efficiency of the configuration files under different application environments can be improved.

Description

Method and device for configuring file
Technical Field
The present invention relates to the field of test technologies, and in particular, to a method and an apparatus for configuring a file.
Background
Users often have multiple environments when developing. A plurality of files are configured according to different application environments in development, test and production. In the prior art, files under different application environments are configured through manual operation, because the process steps of configuring the files are complex and the parameters of the files are more, the situations of repeated configuration and missing configuration exist in the manual configuration, and the parameters under the different application environments are easily mistakenly matched, so that the service cannot be normally started, and the efficiency of configuring the files under the different application environments in the prior art is lower.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for configuring a configuration file, which can improve the efficiency of configuring the configuration file under different application environments. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a method for configuring a file, including:
when a file to be configured of a service to be configured needs to be configured, acquiring a reference file corresponding to the file to be configured;
detecting whether a target file matched with the reference file exists in a pre-storage position, wherein the service name of the target file is the same as that of the reference file, the parameters of the target file correspond to the parameters of the reference file one by one, and the application environment of the target file corresponds to that of the reference file;
if the target file matched with the reference file does not exist in the pre-storage position, judging whether parameters matched with the parameters of the reference file are stored in the pre-storage position, and if so, acquiring the parameters matched with the parameters of the reference file from the pre-storage position;
adding the parameters matched with the parameters of the reference file into the file to be configured, completing the parameter configuration of the file to be configured, taking the file to be configured after the parameters are added as a target file, wherein the service name of the file to be configured is the same as that of the reference file, and the application environment of the file to be configured corresponds to that of the reference file.
Optionally, detecting whether there is a target file matched with the reference file in a pre-stored location includes:
detecting whether a target file matched with a reference file exists in a file pair stored in a pre-storage position, wherein the file pair comprises a pair of files, and the application environments of the pair of files comprise a test environment and an online environment;
or the like, or, alternatively,
and detecting whether a target file matched with the reference file exists in files of different application environments, which are stored in a pre-storage position, and the reference file.
Optionally, the method for configuring a file according to the embodiment of the first aspect of the present invention further includes:
detecting whether the parameters of the file pairs stored in the pre-storage positions correspond to one another;
if the parameters of the file pairs stored in the pre-storage position do not correspond to one another, second prompt information is sent to the user, and the second prompt information is used for reminding the user to determine the file to be modified and delete, add or modify the parameters of the file to be modified;
and receiving the operation of deleting, newly adding or modifying the parameters in the file to be modified fed back by the user according to the received second prompt information.
Optionally, if the parameters of the file pairs stored in the pre-storage location are not in one-to-one correspondence, sending the second prompt message to the user includes:
if the parameters of the file pairs stored in the pre-storage position are not in one-to-one correspondence, third prompt information is sent to the user, and the third prompt information is used for reminding the user of determining the file to be modified in the file pairs;
receiving operation of determining the file to be modified fed back by a user according to the received third prompt information, and deleting parameters, which do not correspond to the parameters of the file to be modified, in the file to be modified under the condition that the parameters of the file to be modified are more than the parameters of the file not to be modified;
determining a parameter to be configured under the condition that the parameter of the file to be modified is less than the parameter of the file not to be modified, wherein the parameter to be configured is the missing parameter of the file to be modified;
judging whether the parameters to be configured are stored in the pre-storage position or not, if so, acquiring the parameters to be configured from the pre-storage position, configuring the parameters to be configured into the file to be modified, wherein the configured parameters of the file to be modified correspond to the parameters of the file not to be modified one by one;
if the parameter to be configured is not stored in the pre-storage position, sending fourth prompt information to the user, wherein the fourth prompt information is used for reminding the user to newly add or modify the parameter of the file to be modified;
and receiving the operation of newly adding or modifying the parameters in the file to be modified fed back by the user according to the received fourth prompt information.
Optionally, after the step of adding the parameter matched with the parameter of the reference file to the file to be configured and taking the file to be configured after the parameter is added as the target file, the method for configuring the file provided in the embodiment of the first aspect of the present invention further includes:
taking the parameters of the target file and the parameters of the reference file as parameter pairs;
taking the target file and the reference file as a file pair;
and storing the file pairs and the parameter pairs into a pre-stored position.
In a second aspect, an apparatus for configuring a file according to an embodiment of the present invention includes:
the file acquisition module is used for acquiring a reference file corresponding to a file to be configured when the file to be configured of the service to be configured needs to be configured;
the file detection module is used for detecting whether a target file matched with the reference file exists in a pre-stored position, the service name of the target file is the same as that of the reference file, the parameters of the target file correspond to the parameters of the reference file one by one, and the application environment of the target file corresponds to the application environment of the reference file;
the parameter acquisition module is used for judging whether a parameter matched with the parameter of the reference file is stored in the pre-storage position or not if the target file matched with the reference file does not exist in the pre-storage position, and acquiring the parameter matched with the parameter of the reference file from the pre-storage position if the target file matched with the parameter of the reference file exists in the pre-storage position;
and the file configuration module is used for adding the parameters matched with the parameters of the reference file into the file to be configured, completing the parameter configuration of the file to be configured, taking the file to be configured after the parameters are added as a target file, wherein the service name of the file to be configured is the same as that of the reference file, and the application environment of the file to be configured corresponds to that of the reference file.
Optionally, the file detection module is specifically configured to:
detecting whether a target file matched with a reference file exists in a file pair stored in a pre-storage position, wherein the file pair comprises a pair of files, and the application environments of the pair of files comprise a test environment and an online environment;
or the like, or, alternatively,
and detecting whether a target file matched with the reference file exists in files of different application environments, which are stored in a pre-storage position, and the reference file.
The device for configuring the file according to the embodiment of the second aspect of the present invention further includes:
the parameter comparison module is used for detecting whether the parameters of the file pairs stored in the pre-storage position correspond to one another;
if the parameters of the file pairs stored in the pre-storage position do not correspond to one another, second prompt information is sent to the user, and the second prompt information is used for reminding the user to determine the file to be modified and delete, add or modify the parameters of the file to be modified;
and receiving the operation of deleting, newly adding or modifying the parameters in the file to be modified fed back by the user according to the received second prompt information.
Optionally, the parameter comparison module is configured to:
if the parameters of the file pairs stored in the pre-storage position are not in one-to-one correspondence, third prompt information is sent to the user, and the third prompt information is used for reminding the user of determining the file to be modified in the file pairs;
receiving operation of determining the file to be modified fed back by a user according to the received third prompt information, and deleting parameters, which do not correspond to the parameters of the file to be modified, in the file to be modified under the condition that the parameters of the file to be modified are more than the parameters of the file not to be modified;
determining a parameter to be configured under the condition that the parameter of the file to be modified is less than the parameter of the file not to be modified, wherein the parameter to be configured is the missing parameter of the file to be modified;
judging whether the parameters to be configured are stored in the pre-storage position or not, if so, acquiring the parameters to be configured from the pre-storage position, configuring the parameters to be configured into the file to be modified, wherein the configured parameters of the file to be modified correspond to the parameters of the file not to be modified one by one;
if the parameter to be configured is not stored in the pre-storage position, sending fourth prompt information to the user, wherein the fourth prompt information is used for reminding the user to newly add or modify the parameter of the file to be modified;
and receiving the operation of newly adding or modifying the parameters in the file to be modified fed back by the user according to the received fourth prompt information.
The device for configuring the file according to the embodiment of the second aspect of the present invention further includes:
the storage module is used for taking the parameters of the target file and the parameters of the reference file as parameter pairs;
taking the target file and the reference file as a file pair;
and storing the file pairs and the parameter pairs into a pre-stored position.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions which, when run on a computer, cause the computer to perform a method of configuring a profile as described in any one of the above.
In yet another aspect of the present invention, the present invention also provides a computer program product containing instructions, which when run on a computer, causes the computer to execute any one of the above-mentioned methods for configuring a profile.
According to the method and the device for configuring the file, provided by the embodiment of the invention, when the file to be configured of the service to be configured needs to be configured, the reference file corresponding to the file to be configured is obtained; detecting whether a target file matched with the reference file exists in a pre-stored position; if the target file matched with the reference file does not exist in the pre-storage position, judging whether a parameter matched with the parameter of the reference file is stored in the pre-storage position, and if so, acquiring the parameter matched with the parameter of the reference file from the pre-storage position; and adding the parameters matched with the parameters of the reference file into the file to be configured to complete the parameter configuration of the file to be configured, and taking the file to be configured after the parameters are added as a target file. Compared with the prior art, the method and the device for configuring the target file have the advantages that whether the parameter matched with the parameter of the reference file is stored in the pre-storage position or not is detected, the parameter matched with the parameter of the reference file is added to the file to be configured, and therefore the target file is configured. The method avoids the situation that repeated configuration and missing configuration exist in artificial configuration due to the complex steps of the configuration file process and more parameters of the configuration file, and improves the efficiency of configuring the configuration file in different application environments. Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart of a method for configuring a file according to an embodiment of the present invention;
FIG. 2 is a flowchart of modifying parameters of a file pair according to an embodiment of the present invention;
FIG. 3 is a flow chart of another method for modifying parameters of a file pair according to an embodiment of the present invention;
FIG. 4 is a flowchart of storing pairs of files and parameters according to an embodiment of the present invention;
FIG. 5 is a block diagram of an apparatus for configuring a profile according to an embodiment of the present invention;
fig. 6 is a structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
According to the method and the device for configuring the file, provided by the embodiment of the invention, when the file to be configured of the service to be configured needs to be configured, the reference file corresponding to the file to be configured is obtained; detecting whether a target file matched with the reference file exists in a pre-stored position; if the target file matched with the reference file does not exist in the pre-storage position, judging whether a parameter matched with the parameter of the reference file is stored in the pre-storage position, and if so, acquiring the parameter matched with the parameter of the reference file from the pre-storage position; and adding the parameters matched with the parameters of the reference file into the file to be configured to complete the parameter configuration of the file to be configured, and taking the file to be configured after the parameters are added as a target file. Compared with the prior art, the method and the device for configuring the target file have the advantages that whether the parameter matched with the parameter of the reference file is stored in the pre-storage position or not is detected, the parameter matched with the parameter of the reference file is added to the file to be configured, and therefore the target file is configured. The method avoids the situation that repeated configuration and missing configuration exist in artificial configuration due to the complex steps of the configuration file process and more parameters of the configuration file, and improves the efficiency of configuring the configuration file in different application environments.
The method for configuring the file provided by the embodiment of the invention is applied to the electronic equipment, and further the electronic equipment can be a mobile phone, a computer, a server, intelligent mobile terminal equipment, wearable intelligent mobile terminal equipment and the like. Without limitation, any electronic device that can implement the present invention is within the scope of the present invention.
First, a method for configuring a profile according to an embodiment of the present invention is described.
As shown in fig. 1, a method for configuring a file according to an embodiment of the present invention includes:
s101, when a file to be configured of a service to be configured needs to be configured, acquiring a reference file corresponding to the file to be configured;
in a specific embodiment, the obtaining of the reference file depends on an application environment of a to-be-configured file of a to-be-configured service, and if a user needs the to-be-configured file of an online environment and the application environment of the to-be-configured file belongs to the online environment, the reference file belongs to a test environment.
In order to improve the accuracy of obtaining the reference file, in S101, at least one implementation manner may be adopted to obtain the reference file corresponding to the file to be configured:
in an optional implementation manner, when a to-be-configured file of a to-be-configured service needs to be configured, a reference file corresponding to the to-be-configured file input by a user is received, so that the accuracy of obtaining the reference file is improved.
In another optional implementation manner, when a to-be-configured file of a to-be-configured service needs to be configured, a reference file corresponding to the to-be-configured file selected by a user is received, so that the accuracy of obtaining the reference file is improved.
S102, detecting whether a target file matched with a reference file exists in a pre-stored position;
the service name of the target file is the same as that of the reference file, the parameters of the target file correspond to the parameters of the reference file one by one, the application environment of the target file corresponds to that of the reference file, and the service name is based on but not limited to the nouns defined by the function, the purpose or the application object of the reference file and is mainly used for distinguishing the files. The pre-storage location may be, but is not limited to, a location for pre-storing the file and the parameter, and the manner in which the file and the parameter can be stored is within the protection scope of the embodiment of the present invention. Illustratively, the pre-stored locations may include, but are not limited to: a cache or a storage area.
In order to improve efficiency of configuring configuration files in different application environments, the above S102 may employ at least one implementation to detect whether there is a target file matching the reference file:
in an alternative embodiment, in a file pair stored in a pre-storage location, whether a target file matched with a reference file exists or not is detected, so that the accuracy of determining the target file is improved.
In another alternative embodiment, whether an object file matched with the reference file exists in files of different application environments stored in a pre-storage position and the reference file is detected, so that the efficiency of detecting the object file is improved.
In yet another alternative embodiment, in the pre-storage location, whether a file exists which has the same name as the reference file, the parameters correspond to the parameters of the reference file one to one, and the application environment corresponds to the application environment of the reference file, if so, the file is determined as the target file, so that the accuracy of determining the target file can be improved.
In yet another alternative embodiment, each file in the pre-storage location is assigned a key value, and the file with the same key value as the reference file is searched for as the target file matching the reference file, so that the target file can be determined quickly.
S103, if the target file matched with the reference file does not exist in the pre-storage position, judging whether a parameter matched with the parameter of the reference file is stored in the pre-storage position, and if the target file does not exist in the pre-storage position, acquiring the parameter matched with the parameter of the reference file from the pre-storage position;
in order to improve efficiency of configuring the configuration file in different application environments, at least one embodiment may be adopted in the S103 to determine whether a parameter matching a parameter of the reference file is stored in the pre-storage location:
in a possible implementation manner, whether parameters corresponding to the parameters of the reference file one by one are stored in the pre-storage position is judged, if yes, the parameters corresponding to the parameters of the reference file one by one are obtained from the pre-storage position and serve as the parameters matched with the parameters of the reference file, and therefore the efficiency of obtaining the parameters matched with the parameters of the reference file is improved.
And S104, adding the parameters matched with the parameters of the reference file into the file to be configured, completing the parameter configuration of the file to be configured, and taking the file to be configured after the parameters are added as a target file.
The service name of the file to be configured is the same as that of the reference file, and the application environment of the file to be configured corresponds to that of the reference file.
For example: the file to be configured of the service to be configured is an online environment, and the reference file is as follows: the application environment of the reference file is a test environment, and the application environment corresponding to the test environment is an online environment. The parameters of the reference file are user _ test, test and dev, and the parameters corresponding to the parameters of the reference file, such as user _ test, test and dev, are user _ online, online and product. The method comprises the steps of taking the user name _ online, the online and the product as parameters of a file to be configured, wherein the application environment of the file to be configured is an online environment, and the parameters of the file to be configured are the user name _ online, the online and the product.
Compared with the prior art, the method and the device for configuring the target file have the advantages that whether the parameter matched with the parameter of the reference file is stored in the pre-storage position or not is detected, the parameter matched with the parameter of the reference file is added to the file to be configured, and therefore the target file is configured. The method avoids the situation that repeated configuration and missing configuration exist in artificial configuration due to the complex steps of the configuration file process and more parameters of the configuration file, and improves the efficiency of configuring the configuration file in different application environments.
As shown in fig. 2, in order to improve the accuracy of the configuration file, after the step of S104, the method for configuring the configuration file according to the embodiment of the present invention further includes:
s201, detecting whether parameters of file pairs stored in a pre-storage position correspond to one another;
the file pair is a pair of files corresponding to application environments, having the same service name and corresponding to parameters one to one, and the application environments of the pair of files comprise a test environment and an online environment. A document pair may include, but is not limited to, a first document and a second document, where the first document and the second document form a document pair, and where relational terms such as first and second are used solely to distinguish one document from another, and do not necessarily require or imply any actual relationship or order between the documents.
For example: in the file pair { username { username _ test, dev; if the user name _ test, test and dev in the user name _ online, online and product } are first files, the application environment of the first file is a test environment, and the application environment corresponding to the test environment is an online environment. The parameters of the first file are user _ test, test and dev, and the parameters corresponding to the parameters of the first file, such as user _ test, test and dev, are user _ online, online and product. The user name _ online, the online and the product are parameters of a second file, the application environment of the second file is an online environment, and the parameters of the second file are the user name _ online, the online and the product. The service names of the first file and the second file are usernames, and the service name of the file pair is username; or username _ test, dev. If the file is the second file, the application environment of the second file is the test environment, the parameters of the second file in the test environment are user _ test, test and dev, and the user _ online, online and product are the first file, the application environment of the first file is the online environment, and the parameters of the first file are user _ online, online and product. The parameters of the first file correspond to the parameters of the second file under the application environment of the second file one by one.
In a possible implementation manner, by detecting whether the parameter of the ith row of the first file in the file pair stored in the pre-storage location corresponds to the parameter of the ith row of the second file one by one, the accuracy of determining whether the parameter of the first file corresponds to the parameter of the second file one by one can be improved.
Wherein, the value of i is a positive integer.
S202, if the parameters of the file pairs stored in the pre-storage position are not in one-to-one correspondence, second prompt information is sent to the user;
the second prompt message is used for prompting the user to determine the file to be modified and delete, add or modify the parameters of the file to be modified, wherein the file to be modified is a file of which the parameters need to be deleted, added or modified.
And S203, receiving the operation of deleting, newly adding or modifying the parameters in the file to be modified fed back by the user according to the received second prompt information.
In a possible implementation manner, the receiving user performs deletion, addition or modification on the parameters of the whole line in the file to be configured, which are fed back according to the received second prompt information, so as to improve the efficiency of modifying the file to be modified.
For example: assume that the first file is: the second username and username _ test files are as follows: username, username _ online, password. If the application environment of the first file is a test environment, the application environment of the second file is an online environment, and the parameters of the first file and the parameters of the second file are not in one-to-one correspondence, sending second prompt information to the user, and adding the dev parameter in the first file by the user; if the first file is: username, username _ test, dev. If the user deletes the parameter password in the second file, the second file is: username, username _ online.
According to the embodiment, the real-time performance of the configuration file can be improved by modifying the parameters of the file to be modified, which are matched with the reference file.
In order to improve the accuracy of the configuration file, in step S203, at least one implementation may be adopted, and in a case that the parameters of the file pairs stored in the pre-storage location are not in one-to-one correspondence, the second prompt information is sent to the user:
as shown in fig. 3, in one embodiment, the second prompting message is sent to the user by the following steps:
s301, if the parameters of the file pairs stored in the pre-storage position do not correspond to one another, third prompt information is sent to the user, and the third prompt information is used for reminding the user of the file pairs and determining the files to be modified;
s302, receiving an operation of determining a file to be modified fed back by a user according to the received third prompt information, and deleting parameters, which do not correspond to the parameters of the file to be modified, in the file to be modified under the condition that the parameters of the file to be modified are more than the parameters of the file not to be modified;
s303, determining parameters to be configured under the condition that the parameters of the file to be modified are less than the parameters of the file not to be modified;
the parameters to be configured are parameters missing from the files to be modified.
S304, judging whether the parameter to be configured is stored in the pre-storage position or not, if so, acquiring the parameter to be configured from the pre-storage position, and configuring the parameter to be configured into the file to be modified;
the parameters of the configured files to be modified correspond to the parameters of the files not to be modified one by one;
s305, if the parameters to be configured and stored in the pre-storage position are not stored, sending fourth prompt information to the user;
the fourth prompt message is used for reminding the user to newly add or modify the parameters of the file to be modified.
S306, receiving the operation of newly adding or modifying the parameters in the file to be modified fed back by the user according to the received fourth prompt message.
The following illustrates a process of sending the second prompt message to the user when the parameters of the file pairs stored in the pre-storage location do not correspond to each other.
For example: assume that the first file is: the second files of username, username _ test and dev are as follows: username, username _ online. And if the application environment of the first file is a test environment, the application environment of the second file is an online environment, and the parameters of the first file and the parameters of the second file are not in one-to-one correspondence, sending third prompt information to the user, and if the user selects the first file as a file to be modified, taking the second file as a reference file. And at the moment, if the parameters of the file to be modified are more than the parameters of the reference file, deleting the parameters dev which do not correspond to the parameters of the reference file in the file to be modified.
Assume that the first file is: username, username _ test; the second file is: the method comprises the steps of using the username, using the username _ online and password, wherein the application environment of the first file is a test environment, the application environment of the second file is an online environment, the parameters of the first file are not in one-to-one correspondence with the parameters of the second file, then sending third prompt information to a user, and if the user selects the second file as a file to be modified, then the first file is a reference file. And at the moment, if the parameter of the file to be modified is less than the parameter of the reference file, sending fourth prompt information to the user, and receiving the operation of newly adding the dev parameter in the file to be modified fed back by the user according to the received fourth prompt information.
In the embodiment, the parameters which do not correspond to the parameters of the reference file are deleted from the file to be modified under the condition that the parameters of the file to be modified correspond to the parameters of the reference file, so that the efficiency of configuring the file to be modified is improved.
As shown in fig. 4, in order to improve the accuracy of the configuration file, after the step of S104, the method for configuring the configuration file according to the embodiment of the present invention further includes:
s401, taking the parameters of the target file and the parameters of the reference file as parameter pairs;
s402, taking the target file and the reference file as a file pair;
and S403, storing the file pairs and the parameter pairs into a pre-stored position.
The embodiment of the invention stores the file pairs and the parameter pairs into the pre-storage position, supplements the file pairs and the parameter pairs in the pre-storage position, and provides materials for subsequently detecting new file pairs and parameter pairs.
The following provides a description of a device for configuring a profile according to an embodiment of the present invention.
As shown in fig. 5, an apparatus for configuring a file according to an embodiment of the present invention includes:
the file obtaining module 501 is configured to obtain a reference file corresponding to a to-be-configured file when the to-be-configured file of a to-be-configured service needs to be configured;
the file detection module 502 is configured to detect whether a target file matched with the reference file exists in a pre-stored location, where the service name of the target file is the same as that of the reference file, the parameters of the target file correspond to the parameters of the reference file one to one, and the application environment of the target file corresponds to the application environment of the reference file;
a parameter obtaining module 503, configured to determine whether a parameter matching the parameter of the reference file is stored in the pre-storage location if the target file matching the reference file does not exist in the pre-storage location, and if the target file matching the parameter of the reference file does exist in the pre-storage location, obtain the parameter matching the parameter of the reference file from the pre-storage location;
the file configuration module 504 is configured to add a parameter matched with a parameter of the reference file to the file to be configured, complete parameter configuration of the file to be configured, use the file to be configured after the parameter is added as a target file, use the service name of the file to be configured as the service name of the reference file, and enable the application environment of the file to be configured to correspond to the application environment of the reference file.
Optionally, the file detection module is specifically configured to:
detecting whether a target file matched with a reference file exists in a file pair stored in a pre-storage position, wherein the file pair comprises a pair of files, and the application environments of the pair of files comprise a test environment and an online environment;
or the like, or, alternatively,
and detecting whether a target file matched with the reference file exists in files of different application environments, which are stored in a pre-storage position, and the reference file.
The device for configuring the file provided by the embodiment of the invention further comprises:
the parameter comparison module is used for detecting whether the parameters of the file pairs stored in the pre-storage position correspond to one another;
if the parameters of the file pairs stored in the pre-storage position do not correspond to one another, second prompt information is sent to the user, and the second prompt information is used for reminding the user to determine the file to be modified and delete, add or modify the parameters of the file to be modified;
and receiving the operation of deleting, newly adding or modifying the parameters in the file to be modified fed back by the user according to the received second prompt information.
Optionally, the parameter comparison module is configured to:
if the parameters of the file pairs stored in the pre-storage position are not in one-to-one correspondence, third prompt information is sent to the user, and the third prompt information is used for reminding the user of determining the file to be modified in the file pairs;
receiving operation of determining the file to be modified fed back by a user according to the received third prompt information, and deleting parameters, which do not correspond to the parameters of the file to be modified, in the file to be modified under the condition that the parameters of the file to be modified are more than the parameters of the file not to be modified;
determining a parameter to be configured under the condition that the parameter of the file to be modified is less than the parameter of the file not to be modified, wherein the parameter to be configured is the missing parameter of the file to be modified;
judging whether the parameters to be configured are stored in the pre-storage position or not, if so, acquiring the parameters to be configured from the pre-storage position, configuring the parameters to be configured into the file to be modified, wherein the configured parameters of the file to be modified correspond to the parameters of the file not to be modified one by one;
if the parameter to be configured is not stored in the pre-storage position, sending fourth prompt information to the user, wherein the fourth prompt information is used for reminding the user to newly add or modify the parameter of the file to be modified;
and receiving the operation of newly adding or modifying the parameters in the file to be modified fed back by the user according to the received fourth prompt information.
The device for configuring the file provided by the embodiment of the invention further comprises:
the storage module is used for taking the parameters of the target file and the parameters of the reference file as parameter pairs;
taking the target file and the reference file as a file pair;
and storing the file pairs and the parameter pairs into a pre-stored position.
An embodiment of the present invention further provides an electronic device, as shown in fig. 6, including a processor 601, a communication interface 602, a memory 603, and a communication bus 604, where the processor 601, the communication interface 602, and the memory 603 complete mutual communication through the communication bus 604,
a memory 603 for storing a computer program;
the processor 601 is configured to implement the following steps when executing the program stored in the memory 603:
when a file to be configured of a service to be configured needs to be configured, acquiring a reference file corresponding to the file to be configured;
detecting whether a target file matched with the reference file exists in a pre-storage position, wherein the service name of the target file is the same as that of the reference file;
if the target file matched with the reference file does not exist in the pre-storage position, judging whether parameters matched with the parameters of the reference file are stored in the pre-storage position, and if so, acquiring the parameters matched with the parameters of the reference file from the pre-storage position;
and adding the parameters matched with the parameters of the reference file into the file to be configured to complete the parameter configuration of the file to be configured, and taking the file to be configured after the parameters are added as a target file.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to perform a method of configuring a profile as described in any of the above embodiments.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform a method of configuring a profile as described in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus/electronic device/computer-readable storage medium/computer program product embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and for relevant points, reference may be made to some descriptions of the method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (9)

1. A method of configuring a profile, the method comprising:
when a file to be configured of a service to be configured needs to be configured, acquiring a reference file corresponding to the file to be configured; the acquisition of the reference file depends on the application environment of the file to be configured of the required service to be configured; when the application environment of the file to be configured is a test environment, the obtained application environment corresponding to the reference file is an online environment, and when the application environment of the file to be configured is an online environment, the obtained application environment corresponding to the reference file is a test environment;
detecting whether an object file matched with the reference file exists in a pre-stored position, wherein the matched object file refers to: the service name of the target file is the same as that of the reference file, the parameters of the target file correspond to the parameters of the reference file one by one, the application environment of the target file corresponds to the application environment of the reference file, when the application environment of the reference file is a test environment, the application environment of the matched target file is an online environment, and when the application environment of the reference file is an online environment, the application environment of the matched target file is a test environment;
if the target file matched with the reference file does not exist in the pre-storage position, judging whether a parameter matched with the parameter of the reference file is stored in the pre-storage position, and if so, acquiring the parameter matched with the parameter of the reference file from the pre-storage position;
adding parameters matched with the parameters of the reference file into a file to be configured, completing parameter configuration of the file to be configured, taking the file to be configured after the parameters are added as a target file, wherein the service name of the file to be configured is the same as that of the reference file, and the application environment of the file to be configured corresponds to that of the reference file;
in the pre-stored location, detecting whether there is a target file matching the reference file, including:
detecting whether a target file matched with the reference file exists in a file pair stored in the pre-storage position, wherein the file pair is a pair of files corresponding to application environments, identical in service name and corresponding to parameters one by one, the application environment of one file in the pair of files is a test environment, and the application environment of the other file is an online environment;
or the like, or, alternatively,
and detecting whether a target file matched with the reference file exists in files of different application environments, which are stored in the pre-storage position, and the reference file.
2. The method of claim 1, further comprising:
detecting whether the parameters of the file pairs stored in the pre-storage positions correspond to one another;
if the parameters of the file pairs stored in the pre-storage position do not correspond to one another, second prompt information is sent to the user, and the second prompt information is used for reminding the user to determine the file to be modified and deleting, adding or modifying the parameters of the file to be modified;
and receiving the operation of deleting, newly adding or modifying the parameters in the file to be modified fed back by the user according to the received second prompt information.
3. The method according to claim 2, wherein if the parameters of the file pairs stored in the pre-storage location do not correspond to one another, sending a second prompt message to the user comprises:
if the parameters of the file pairs stored in the pre-storage position are not in one-to-one correspondence, third prompt information is sent to the user, and the third prompt information is used for reminding the user of determining the file to be modified in the file pairs;
receiving an operation of determining a file to be modified fed back by a user according to the received third prompt information, and deleting parameters, which do not correspond to the parameters of the file not to be modified, in the file to be modified under the condition that the parameters of the file to be modified are more than the parameters of the file not to be modified;
determining a parameter to be configured under the condition that the parameter of the file to be modified is less than the parameter of the file not to be modified, wherein the parameter to be configured is the missing parameter of the file to be modified;
judging whether the parameter to be configured is stored in the pre-storage position, if so, acquiring the parameter to be configured from the pre-storage position, configuring the parameter to be configured into the file to be modified, wherein the configured parameter of the file to be modified corresponds to the parameter of the file not to be modified one by one;
if the parameter to be configured is not stored in the pre-storage position, sending fourth prompt information to the user, wherein the fourth prompt information is used for reminding the user to newly add or modify the parameter of the file to be modified;
and receiving the operation of newly adding or modifying the parameters in the file to be modified fed back by the user according to the received fourth prompt information.
4. The method according to any one of claims 1 to 3, wherein after the step of adding the parameter matching the parameter of the reference file to the file to be configured, and taking the file to be configured after the parameter is added as the target file, the method further comprises:
taking the parameters of the target file and the parameters of the reference file as parameter pairs;
taking the target file and the reference file as a file pair;
storing the pair of files and the pair of parameters into the pre-memory location.
5. An apparatus for configuring a profile, the apparatus comprising:
the file acquisition module is used for acquiring a reference file corresponding to a file to be configured when the file to be configured of a service to be configured needs to be configured; the acquisition of the reference file depends on the application environment of the file to be configured of the required service to be configured; when the application environment of the file to be configured is a test environment, the obtained application environment corresponding to the reference file is an online environment, and when the application environment of the file to be configured is an online environment, the obtained application environment corresponding to the reference file is a test environment;
a file detection module, configured to detect whether there is an object file that matches the reference file in a pre-stored location, where the matching object file is: the service name of the target file is the same as that of the reference file, the parameters of the target file correspond to the parameters of the reference file one by one, the application environment of the target file corresponds to the application environment of the reference file, when the application environment of the reference file is a test environment, the application environment of the matched target file is an online environment, and when the application environment of the reference file is an online environment, the application environment of the matched target file is a test environment;
the parameter acquisition module is used for judging whether a parameter matched with the parameter of the reference file is stored in the pre-storage position or not if the target file matched with the reference file does not exist in the pre-storage position, and acquiring the parameter matched with the parameter of the reference file from the pre-storage position if the target file matched with the parameter of the reference file exists in the pre-storage position;
the file configuration module is used for adding parameters matched with the parameters of the reference file into a file to be configured, completing parameter configuration of the file to be configured, taking the file to be configured after the parameters are added as a target file, wherein the service name of the file to be configured is the same as that of the reference file, and the application environment of the file to be configured corresponds to that of the reference file;
the file detection module is specifically configured to:
detecting whether a target file matched with the reference file exists in a file pair stored in the pre-storage position, wherein the file pair is a pair of files corresponding to application environments, identical in service name and corresponding to parameters one by one, the application environment of one file in the pair of files is a test environment, and the application environment of the other file is an online environment;
or the like, or, alternatively,
and detecting whether a target file matched with the reference file exists in files of different application environments, which are stored in the pre-storage position, and the reference file.
6. The apparatus of claim 5, further comprising:
the parameter comparison module is used for detecting whether the parameters of the file pairs stored in the pre-storage position correspond to one another;
if the parameters of the file pairs stored in the pre-storage position do not correspond to one another, second prompt information is sent to the user, and the second prompt information is used for reminding the user to determine the file to be modified and deleting, adding or modifying the parameters of the file to be modified;
and receiving the operation of deleting, newly adding or modifying the parameters in the file to be modified fed back by the user according to the received second prompt information.
7. The apparatus of claim 6, wherein the parameter comparison module is configured to:
if the parameters of the file pairs stored in the pre-storage position are not in one-to-one correspondence, third prompt information is sent to the user, and the third prompt information is used for reminding the user of determining the file to be modified in the file pairs;
receiving an operation of determining a file to be modified fed back by a user according to the received third prompt information, and deleting parameters, which do not correspond to the parameters of the file not to be modified, in the file to be modified under the condition that the parameters of the file to be modified are more than the parameters of the file not to be modified;
determining a parameter to be configured under the condition that the parameter of the file to be modified is less than the parameter of the file not to be modified, wherein the parameter to be configured is the missing parameter of the file to be modified;
judging whether the parameter to be configured is stored in the pre-storage position, if so, acquiring the parameter to be configured from the pre-storage position, configuring the parameter to be configured into the file to be modified, wherein the configured parameter of the file to be modified corresponds to the parameter of the file not to be modified one by one;
if the parameter to be configured is not stored in the pre-storage position, sending fourth prompt information to the user, wherein the fourth prompt information is used for reminding the user to newly add or modify the parameter of the file to be modified;
and receiving the operation of newly adding or modifying the parameters in the file to be modified fed back by the user according to the received fourth prompt information.
8. The apparatus of any one of claims 5 to 7, further comprising:
the storage module is used for taking the parameters of the target file and the parameters of the reference file as parameter pairs;
taking the target file and the reference file as a file pair;
storing the pair of files and the pair of parameters into the pre-memory location.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 4 when executing a program stored in the memory.
CN201910185358.9A 2019-03-12 2019-03-12 Method and device for configuring file Active CN109976828B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910185358.9A CN109976828B (en) 2019-03-12 2019-03-12 Method and device for configuring file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910185358.9A CN109976828B (en) 2019-03-12 2019-03-12 Method and device for configuring file

Publications (2)

Publication Number Publication Date
CN109976828A CN109976828A (en) 2019-07-05
CN109976828B true CN109976828B (en) 2022-04-22

Family

ID=67078641

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910185358.9A Active CN109976828B (en) 2019-03-12 2019-03-12 Method and device for configuring file

Country Status (1)

Country Link
CN (1) CN109976828B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110941460B (en) * 2019-11-22 2023-09-01 北京金山云网络技术有限公司 Application program starting method and device, electronic equipment, system and storage medium
CN112433783A (en) * 2020-11-24 2021-03-02 平安普惠企业管理有限公司 Configuration method and related equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101588268A (en) * 2009-06-29 2009-11-25 杭州华三通信技术有限公司 Method and device for configuration files of universal extensible management device
CN104331292A (en) * 2014-11-03 2015-02-04 重庆邮电大学 Method for generating configuration for middleware protocol conversion of Internet of vehicles
WO2016102175A1 (en) * 2014-12-22 2016-06-30 Eaton Industries (Netherlands) B.V. Computer implemented method for displaying a user interface
EP3133491A1 (en) * 2012-03-31 2017-02-22 BMC Software, Inc. Self-evolving computing service template translation
CN107798459A (en) * 2017-07-27 2018-03-13 平安科技(深圳)有限公司 Parameter values computational methods, device, storage medium and computer equipment
CN107967159A (en) * 2017-11-22 2018-04-27 腾讯科技(深圳)有限公司 The method and server of a kind of profileapplied

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6141712A (en) * 1998-01-30 2000-10-31 Object Technology Licensing Corporation Apparatus and method for modeling behavior of expansion boards in a computer system
US8782603B2 (en) * 2010-12-21 2014-07-15 Sap Ag Standardized configuration checklists for software development
US10116508B2 (en) * 2012-05-30 2018-10-30 Hewlett Packard Enterprise Development, LP Server profile templates
AU2013308873A1 (en) * 2012-08-28 2015-03-05 VCE Company LLC Integrated computing platform deployed in an existing computing environment
CN103914370B (en) * 2012-12-31 2017-05-10 百度国际科技(深圳)有限公司 XML (Extensive Markup Language) configuration file based test method and device
CN104516738A (en) * 2014-12-15 2015-04-15 北京金和软件股份有限公司 Integrated implementing method for development and release of APP
CN106021043A (en) * 2016-05-10 2016-10-12 浪潮电子信息产业股份有限公司 Method and device for acquiring configuration information of server
JP2018018415A (en) * 2016-07-29 2018-02-01 富士通株式会社 Information processing device, information processing system, program and information processing method
CN107092502B (en) * 2017-03-20 2020-06-16 国家电网有限公司 Automatic application configuration method and device based on cloud operating system
US10379844B2 (en) * 2017-03-29 2019-08-13 Ca, Inc. Validating user interface templates for software probe configuration
CN107085516A (en) * 2017-03-31 2017-08-22 北京奇艺世纪科技有限公司 A kind of method and device for changing configuration
CN107463418B (en) * 2017-09-12 2020-11-13 北京宝兰德软件股份有限公司 Configuration file generation method and device for server middleware
CN108259556A (en) * 2017-11-30 2018-07-06 北京九五智驾信息技术股份有限公司 Method for parameter configuration and terminal

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101588268A (en) * 2009-06-29 2009-11-25 杭州华三通信技术有限公司 Method and device for configuration files of universal extensible management device
EP3133491A1 (en) * 2012-03-31 2017-02-22 BMC Software, Inc. Self-evolving computing service template translation
CN104331292A (en) * 2014-11-03 2015-02-04 重庆邮电大学 Method for generating configuration for middleware protocol conversion of Internet of vehicles
WO2016102175A1 (en) * 2014-12-22 2016-06-30 Eaton Industries (Netherlands) B.V. Computer implemented method for displaying a user interface
CN107798459A (en) * 2017-07-27 2018-03-13 平安科技(深圳)有限公司 Parameter values computational methods, device, storage medium and computer equipment
CN107967159A (en) * 2017-11-22 2018-04-27 腾讯科技(深圳)有限公司 The method and server of a kind of profileapplied

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
脚本自动生成测试系统的设计与实现;林惠娟 等;《四川大学学报(自然科学版)》;20060831;第43卷(第4期);第773页-第776页 *

Also Published As

Publication number Publication date
CN109976828A (en) 2019-07-05

Similar Documents

Publication Publication Date Title
US10936669B2 (en) Object clustering method and system
US10547618B2 (en) Method and apparatus for setting access privilege, server and storage medium
CN110737658A (en) Data fragment storage method, device, terminal and readable storage medium
CN109376078B (en) Mobile application testing method, terminal equipment and medium
CN108650260B (en) Malicious website identification method and device
CN107315825B (en) Index updating system, method and device
CN110851308A (en) Test method, test device, electronic equipment and storage medium
CN107992738B (en) Account login abnormity detection method and device and electronic equipment
CN109976828B (en) Method and device for configuring file
CN113468515A (en) User identity authentication method and device, electronic equipment and storage medium
CN109491733B (en) Interface display method based on visualization and related equipment
JP5264813B2 (en) Evaluation apparatus, evaluation method, and evaluation program
CN111339137A (en) Data verification method and device
CN110688305B (en) Test environment synchronization method, device, medium and electronic equipment
CN114564297A (en) Task execution sequence calculation method, device and equipment and readable storage medium
CN109391658B (en) Account data synchronization method and equipment, storage medium and terminal thereof
CN106658670B (en) A kind of Wireless Fidelity Wi-Fi scan method and mobile terminal
CN109871361B (en) File uploading method and device, electronic equipment and readable storage medium
CN111258899A (en) Use case generation method and device, electronic equipment and computer readable storage medium
CN111737218A (en) File sharing method and device
CN111858497A (en) Storage type conversion method, device and equipment
CN110784479B (en) Data verification method and device, electronic equipment and storage medium
CN115617602A (en) Event data analysis method and device, electronic equipment and storage medium
CN111309592B (en) Authority checking method, device, storage medium and terminal
EP3823326A1 (en) System and method for detecting bluetooth security threat, and computer readable medium therefor

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
GR01 Patent grant
GR01 Patent grant