这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions config/configuration.yaml.sample
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
debug: false
http:
port: 8126
username:
password:
docker_connection:
type: socket
path: /var/run/docker.sock
host:
port:
path: /var/run/docker.sock
24 changes: 17 additions & 7 deletions default_settings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var convict = require('convict');
yaml = require('js-yaml');
fs = require('fs');

var config = convict({
debug: {
Expand All @@ -16,12 +17,12 @@ var config = convict({
username: {
doc: 'Optional. The HTTP Username for authentication',
format: String,
default: ''
default: undefined
},
password: {
doc: 'Optional. The HTTP Password for authentication',
format: String,
default: '',
default: undefined,
sensitive: true
}
},
Expand All @@ -37,13 +38,14 @@ var config = convict({
default: '/var/run/docker.sock'
},
host: {
doc: 'URL to remote docker host',
doc: 'Optional. URL to remote docker host',
format: String,
default: ''
default: undefined
},
port: {
doc: 'Port on remote docker host',
format: 'port_or_windows_named_pipe'
doc: 'Optional. Port on remote docker host',
format: 'port_or_windows_named_pipe',
default: undefined
}
}
});
Expand All @@ -52,7 +54,15 @@ var config = convict({
convict.addParser({ extension: ['yml', 'yaml'], parse: yaml.safeLoad });
var config_dir = process.env.config_dir || "./config";
console.log("Loading settings from " + config_dir);
config.loadFile(config_dir + '/configuration.yaml');

//Check if the configuration file exists, if it doesn't then skip this
try{
if (fs.existsSync(config_dir + '/configuration.yaml')) {
config.loadFile(config_dir + '/configuration.yaml');
}
} catch(err) {
console.warn("No configuration file detected. Using default settings");
}

// Perform validation
config.validate({allowed: 'warn'});
Expand Down
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ You can change some configuration options for this service by editing config/con
| Option | Description | Default Value |
|------------------------|------------------------------------------------------------------------------------------------------------------|----------------------|
| debug | If set to true, will output some helpful debug messages to the console. | false |
| http.port | The HTTP port the service listens on. | 8126 |
| http.username | If set all calls to this service must use HTTP basic authentication with this username. | None |
| http.password | If set all calls to this service must use HTTP basic authentication with this password. | None |
| http.port | The HTTP port the service listens on. Must be a valid HTTP port or windows socket. | 8126 |
| http.username | If set all calls to this service must use HTTP basic authentication with this username. **If set, must not be an empty value.** | None |
| http.password | If set all calls to this service must use HTTP basic authentication with this password. **If set, must not be an empty value.** | None |
| docker_connection.type | How the service connects to docker. Valid options are socket or http | socket |
| docker_connection.path | The path to the Docker socket. Useful when running this service on the host directly (not in a Docker container) | /var/run/docker.sock |
| docker_connection.host | The host IP/Domain of the host Docker to connect to. Only used when docker_connection.type is set to http | None |
| docker_connection.port | The port of the host Docker to connect to. Only used when docker_connection.type is set to http | None |
| docker_connection.host | The host IP/Domain of the host Docker to connect to. Only used when `docker_connection.type` is set to `http`. **If set, must not be an empty value.** | None |
| docker_connection.port | The port of the host Docker to connect to. Only used when `docker_connection.type` is set to `http`. **If set, must not be an empty value.** | None |

### Connecting to Docker

Expand Down