Skip to content

Commit

Permalink
refactor: added node EOL in example
Browse files Browse the repository at this point in the history
  • Loading branch information
aarontravass committed Dec 17, 2023
1 parent 4452182 commit 3ef6cf4
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions examples/simplequeue/index.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { AzureQueueConsumer } from 'az-queue-consumer'
import { readFileSync } from 'node:fs'
import { EOL } from 'node:os'

// read .env file
;(() => {
const file = readFileSync('./.env', { encoding: 'utf-8' }).toString()
file.split('\r\n').forEach((env) => {
for (let end = 0; end < env.length; end++) {
if (env.charAt(end) == '=') {
const key = env.slice(0, end)
let value = env.slice(end + 1)
if (value.charAt(0) == "'") value = value.slice(1)
if (value.charAt(value.length - 1) == "'") value = value.slice(0, value.length - 1)
process.env[key] = value
break
;(() =>
readFileSync('./.env', { encoding: 'utf-8' })
.toString()
.split(EOL)
.forEach((env) => {
for (let end = 0; end < env.length; end++) {
if (env.charAt(end) == '=') {
const key = env.slice(0, end)
let value = env.slice(end + 1)
if (value.charAt(0) == "'") value = value.slice(1)
if (value.charAt(value.length - 1) == "'") value = value.slice(0, value.length - 1)
process.env[key] = value
break
}
}
}
})
})()


}))()

const client = new AzureQueueConsumer(
process.env.AZURE_QUEUE_NAME!,
Expand Down

0 comments on commit 3ef6cf4

Please sign in to comment.