Skip to content

Commit

Permalink
review settings template
Browse files Browse the repository at this point in the history
  • Loading branch information
ridomin committed Sep 16, 2022
1 parent 9c07bdc commit d329a1d
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 34 deletions.
7 changes: 6 additions & 1 deletion samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

This folder contains sample projects with devices that can be connected to multiple MQTT endpoints

>Note: All samples must be run with the `ConnectionStrings__cs` envvar, or as CLI argument `/ConnectionStrings:cs` . There are sample connection strings in the launchSettings.json.template to use as `dotnet run --launch-profile`
All samples must be run with the `ConnectionStrings__cs` envvar, or as CLI argument `/ConnectionStrings:cs` .

There are sample connection strings in the `launchSettings.json.template` to use as `dotnet run --launch-profile`:

- Rename the file to `launchSettings.json`
- Set device credentials (this file is .gitignored)

## memmon

Expand Down
22 changes: 11 additions & 11 deletions samples/memmon/Properties/launchSettings.json.template
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"profiles": {
"mosquitto-localhost": {
"localhost": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=localhost;TcpPort=1883;DeviceId=memmon01;UserName=user;Password=password"
"ConnectionStrings__cs": "HostName=localhost;TcpPort=1883;UseTls=false;DeviceId=mqtt-device;UserName=user;Password=password"
}
},
"localhost_tls": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=localhost;DeviceId=mqtt-device;UserName=user;Password=password;CaFile=localhost.pem"
}
},
"iothub": {
Expand All @@ -25,22 +31,16 @@
"masterKey": "<enrollmentMasterKey>"
}
},
"aws": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=<host.and.region>.amazonaws.com;X509Key=cert.pem|cert.key"
}
},
"hub-x509": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=<hub=name>.azure-devices.net;X509Key=cert.pem|cert.key"
"ConnectionStrings__cs": "HostName=<hub=name>.azure-devices.net;X509Key=<cert.pem>|<cert.key>"
}
},
"broker-x509": {
"mosquitto_tls": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=testmosquitto.org;tcpport=8884;X509Key=ca-device.pem|ca-device.key;cafile=mosquitto.org.crt"
"ConnectionStrings__cs": "HostName=test.mosquitto.org;ClientId=mqtt-device;CaFile=test.mosquitto.org.crt"
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions samples/mqtt-device/Properties/launchSettings.json.template
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"profiles": {
"mosquitto-localhost": {
"localhost": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=localhost;TcpPort=1883;UseTls=false;DeviceId=sampledevice;UserName=user;Password=password;CaFile=localhost.ca.pem"
"ConnectionStrings__cs": "HostName=localhost;TcpPort=1883;UseTls=false;DeviceId=mqtt-device;UserName=user;Password=password"
}
},
"localhost_tls": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=localhost;DeviceId=mqtt-device;UserName=user;Password=password;CaFile=localhost.pem"
}
},
"iothub": {
Expand All @@ -25,22 +31,16 @@
"masterKey": "<enrollmentMasterKey>"
}
},
"aws": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=<host.and.region>.amazonaws.com;X509Key=cert.pem|cert.key"
}
},
"hub-x509": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=<hub=name>.azure-devices.net;X509Key=cert.pem|cert.key"
"ConnectionStrings__cs": "HostName=<hub=name>.azure-devices.net;X509Key=<cert.pem>|<cert.key>"
}
},
"broker-x509": {
"mosquitto_tls": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=testmosquitto.org;tcpport=8884;X509Key=ca-device.pem|ca-device.key;cafile=mosquitto.org.crt"
"ConnectionStrings__cs": "HostName=test.mosquitto.org;ClientId=mqtt-device;CaFile=test.mosquitto.org.crt"
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions samples/pi-sense-device/Properties/launchSettings.json.template
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"profiles": {
"mosquitto-localhost": {
"localhost": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=localhost;TcpPort=1883;DeviceId=memmon01;UserName=user;Password=password"
"ConnectionStrings__cs": "HostName=localhost;TcpPort=1883;UseTls=false;DeviceId=mqtt-device;UserName=user;Password=password"
}
},
"localhost_tls": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=localhost;DeviceId=mqtt-device;UserName=user;Password=password;CaFile=localhost.pem"
}
},
"iothub": {
Expand All @@ -25,22 +31,16 @@
"masterKey": "<enrollmentMasterKey>"
}
},
"aws": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=<host.and.region>.amazonaws.com;X509Key=cert.pem|cert.key"
}
},
"hub-x509": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=<hub=name>.azure-devices.net;X509Key=cert.pem|cert.key"
"ConnectionStrings__cs": "HostName=<hub=name>.azure-devices.net;X509Key=<cert.pem>|<cert.key>"
}
},
"broker-x509": {
"mosquitto_tls": {
"commandName": "Project",
"environmentVariables": {
"ConnectionStrings__cs": "HostName=testmosquitto.org;tcpport=8884;X509Key=ca-device.pem|ca-device.key;cafile=mosquitto.org.crt"
"ConnectionStrings__cs": "HostName=test.mosquitto.org;ClientId=mqtt-device;CaFile=test.mosquitto.org.crt"
}
}
}
Expand Down
24 changes: 24 additions & 0 deletions samples/pi-sense-device/mosquitto.org.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-----BEGIN CERTIFICATE-----
MIIEAzCCAuugAwIBAgIUBY1hlCGvdj4NhBXkZ/uLUZNILAwwDQYJKoZIhvcNAQEL
BQAwgZAxCzAJBgNVBAYTAkdCMRcwFQYDVQQIDA5Vbml0ZWQgS2luZ2RvbTEOMAwG
A1UEBwwFRGVyYnkxEjAQBgNVBAoMCU1vc3F1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