Skip to content

Commit

Permalink
Merge e4f2b0d into 868b9f5
Browse files Browse the repository at this point in the history
  • Loading branch information
padraic-padraic committed Jun 30, 2020
2 parents 868b9f5 + e4f2b0d commit b8db993
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/node-opcua-server/source/opcua_server.ts
Expand Up @@ -11,7 +11,7 @@ import { EventEmitter } from "events";
import * as _ from "underscore";
import { callbackify } from "util";

import { extractFullyQualifiedDomainName } from "node-opcua-hostname";
import { extractFullyQualifiedDomainName, getFullyQualifiedDomainName } from "node-opcua-hostname";

import { assert } from "node-opcua-assert";
import * as utils from "node-opcua-utils";
Expand Down Expand Up @@ -643,6 +643,12 @@ export enum RegisterServerMethod {

export interface OPCUAServerEndpointOptions {

/**
* the primary hostname of the endpoint.
* @default getFullyQualifiedDomainName()
*/
hostname?: string;

/**
* the TCP port to listen to.
* @default 26543
Expand Down Expand Up @@ -1075,10 +1081,11 @@ export class OPCUAServer extends OPCUABaseServer {
this.objectFactory = new Factory(this.engine);

const endpointDefinitions = options.alternateEndpoints || [];
var hostname = getFullyQualifiedDomainName();

endpointDefinitions.push({
port: options.port || 26543,

hostname: options.hostname || hostname,
allowAnonymous: options.allowAnonymous,
alternateHostname: options.alternateHostname,
disableDiscovery: options.disableDiscovery,
Expand Down Expand Up @@ -3313,7 +3320,8 @@ export class OPCUAServer extends OPCUABaseServer {
if (!endpointOptions) {
throw new Error("internal error");
}

var hostname = getFullyQualifiedDomainName();
endpointOptions.hostname = endpointOptions.hostname || hostname;
endpointOptions.port = endpointOptions.port || 26543;

/* istanbul ignore next */
Expand All @@ -3334,6 +3342,7 @@ export class OPCUAServer extends OPCUABaseServer {
securityModes: endpointOptions.securityModes,
securityPolicies: endpointOptions.securityPolicies,

hostname: endpointOptions.hostname,
alternateHostname,

disableDiscovery: !!endpointOptions.disableDiscovery,
Expand Down

0 comments on commit b8db993

Please sign in to comment.