-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reactions to configuration to allow different zaps values. Update…
… ZAP_VALUE to DEFAULT_ZAP_VALUE.
- Loading branch information
1 parent
23a92eb
commit d7b3921
Showing
5 changed files
with
40 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,30 @@ | ||
import dotenv from 'dotenv'; | ||
import { nip19 } from 'nostr-tools'; | ||
import { nip19 } from 'nostr-tools'; | ||
|
||
import { Reaction } from 'src/interfaces/config'; | ||
|
||
dotenv.config(); | ||
|
||
const nPubKey = process.env.USER_PUBLIC_KEY; | ||
const serverRelays = process.env.NOSTR_RELAYS; | ||
|
||
export const secretKey = process.env.USER_SECRET_KEY ?? ''; | ||
export const zapValue = process.env.ZAP_VALUE ?? "0"; | ||
export const zapValue = process.env.DEFAULT_ZAP_VALUE ?? "0"; | ||
export const publicKey = nip19.decode(nPubKey ?? ''); | ||
export const nostrRelays = serverRelays?.split(',') || []; | ||
|
||
const reactions: Reaction[] = []; | ||
|
||
Object.keys(process.env).forEach((element) => { | ||
if (element.startsWith('REACTION_VALUE') && !!process.env[element]) { | ||
const value = process.env[element]?.split('|'); | ||
|
||
if (value?.[0]) { | ||
const reaction = { type: value[0], value: parseInt(value[1]) }; | ||
reactions.push(reaction); | ||
} | ||
} | ||
}); | ||
|
||
export const reactionsValues = reactions; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface Reaction { | ||
type: string; | ||
value: number; | ||
} |