Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Issue 180: PhantomJS Config File #140

Merged
merged 13 commits into from
Aug 31, 2011
Merged

Conversation

execjosh
Copy link
Contributor

Here is a config file implementation. It attempts to load a global and then a local config file (in that order). The values are then overridden in the command-line option parsing loop.

The config files are named .phantomjsrc and contain only one section: phantomjs. The names of the keys are simply the camelCased equivalents of the corresponding command-line options.

It searches for the global config in QDir::homePath() and the local config in QDir::currentPath().

Here is an example of a default .phantomjsrc:

[phantomjs]
loadImages = yes
loadPlugins = no
proxy =
diskCache = no
ignoreSslErrors = no
localAccessRemote = no
cookies =
outputEncoding = utf8
scriptEncoding = utf8

@execjosh
Copy link
Contributor Author

I implemented a JSON version and removed the ini file stuff. Please have a look.

Using a config is as simple as setting the command-line option, like so:

$ ./bin/phantomjs --config=./phantomjs.json ./examples/hello.js

Here's an example config (naturally, unused options can be omitted):

{
    "loadImages": true,
    "loadPlugins": false,
    "proxy": null,
    "diskCache": false,
    "ignoreSslErrors": false,
    "localAccessRemote": false,
    "cookies": null,
    "outputEncoding": "utf8",
    "scriptEncoding": "utf8",
}

ariya added a commit that referenced this pull request Aug 31, 2011
@ariya ariya merged commit 3446548 into ariya:master Aug 31, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants