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

Commit

Permalink
add siamux port to advanced settings
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed May 18, 2020
1 parent fb5697a commit 53c74ed
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/components/SettingsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@
<label class="error" v-if="errors['hostPort']">{{ errors['hostPort'] }}</label>
</transition>
</div>
<div class="control">
<label>SiaMux Port</label>
<input type="text" v-model="siaMuxPort" placeholder=":9983" />
<transition name="fade" mode="out-in" appear>
<label class="error" v-if="errors['siaMuxPort']">{{ errors['siaMuxPort'] }}</label>
</transition>
</div>
<div class="control">
<label>RPC Port</label>
<input type="text" v-model="rpcPort" placeholder=":9981" />
Expand Down Expand Up @@ -126,6 +133,7 @@ export default {
apiPassword: '',
dataPath: '',
hostPort: '',
siaMuxPort: '',
rpcPort: '',
notice: null,
errors: {},
Expand All @@ -146,6 +154,11 @@ export default {
hasErrors = true;
}
if (this.siaMuxPort && this.siaMuxPort.length > 0 && portRegex.exec(this.siaMuxPort) === null) {
errors['siaMuxPort'] = 'SiaMux port must match the format :9983';
hasErrors = true;
}
if (this.rpcPort && this.rpcPort.length > 0 && portRegex.exec(this.rpcPort) === null) {
errors['rpcPort'] = 'RPC port must match the format :9981';
hasErrors = true;
Expand All @@ -166,6 +179,7 @@ export default {
this.apiAgent = this.config.siad_api_agent;
this.apiPassword = this.config.siad_api_password;
this.dataPath = this.config.siad_data_path;
this.siaMuxPort = this.config.siad_siamux_port;
this.hostPort = this.config.siad_host_port;
this.rpcPort = this.config.siad_rpc_port;
},
Expand All @@ -179,6 +193,7 @@ export default {
siad_api_agent: this.apiAgent,
siad_api_password: this.apiPassword,
siad_data_path: this.dataPath,
siad_siamux_port: this.siaMuxPort,
siad_host_port: this.hostPort,
siad_rpc_port: this.rpcPort
};
Expand Down Expand Up @@ -252,6 +267,17 @@ export default {
if (this.changed)
this.notice = 'Changes will not take effect until daemon restart.';
},
siaMuxPort(val) {
this.validate();
if (this.changed)
return;
this.changed = (val !== this.config.siad_siamux_port);
if (this.changed)
this.notice = 'Changes will not take effect until daemon restart.';
},
hostPort(val) {
this.validate();
Expand Down
3 changes: 3 additions & 0 deletions src/sia/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ function buildArgs(config) {
if (typeof config.siad_host_port === 'string' && config.siad_host_port.length > 0)
args.push('--host-addr', config.siad_host_port);

if (typeof config.siad_siamux_port === 'string' && config.siad_siamux_port.length > 0)
args.push('--siamux-addr', config.siad_siamux_port);

if (typeof config.siad_rpc_port === 'string' && config.siad_rpc_port.length > 0)
args.push('--rpc-addr', config.siad_rpc_port);

Expand Down
7 changes: 7 additions & 0 deletions src/views/setup/DaemonOverrideStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<h3>Do you want to change any Daemon flags?</h3>
<p>Some hosts use custom ports or change their API authentication. Change any of the daemon settings you need to. Leave blank to use the default value.</p>
</template>
<div class="control">
<label>SiaMux Port</label>
<input type="text" v-model="hostPort" placeholder=":9983" />
</div>
<div class="control">
<label>Host Port</label>
<input type="text" v-model="hostPort" placeholder=":9982" />
Expand Down Expand Up @@ -47,13 +51,15 @@ export default {
mounted() {
this.userAgent = this.config.siad_api_agent;
this.hostPort = this.config.siad_host_port;
this.siaMuxPort = this.config.siad_siamux_port;
this.rpcPort = this.config.siad_rpc_port;
this.apiAddr = this.config.siad_api_addr;
},
data() {
return {
userAgent: null,
hostPort: null,
siaMuxPort: null,
rpcPort: null,
apiAddr: null,
apiPassword: null
Expand All @@ -66,6 +72,7 @@ export default {
config: {
'siad_api_agent': this.userAgent,
'siad_host_port': this.hostPort,
'siad_siamux_port': this.siaMuxPort,
'siad_rpc_port': this.rpcPort,
'siad_api_addr': this.apiAddr,
'siad_api_password': this.apiPassword
Expand Down

0 comments on commit 53c74ed

Please sign in to comment.