From 0b091b1f521af8f540960a4f74b915bfaa71c88b Mon Sep 17 00:00:00 2001 From: wileyj Date: Tue, 23 Mar 2021 10:58:04 -0400 Subject: [PATCH] adding ADMIN_PASSWORD env var --- README.md | 8 ++++++++ src/config.js | 10 ++++++---- src/developmode.js | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9c00b36..92cbee9 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,14 @@ $ which blockstack-subdomain-registrar The subdomain registrar functions roughly as follows --- you give the registrar a _domain_ to register subdomains under, you fund a wallet to submit registrations with, it accepts registration requests, and then it periodically issues _batches_ of name registrations. +### Setting the Admin Password +1. Set the `ADMIN_PASSWORD` environment var to strong password. +ex: +```bash +$ pwgen -c 64 1 +raj5gohhai0ni3bah4chaa6keeCh4Oophongaikeichie2eirah8AjooyahZaifi +``` + ### Setting the Domain Name For example, if I want to register names like `alice.people.id` or `bob.people.id`, I have to: diff --git a/src/config.js b/src/config.js index d4a7f01..1eca1f9 100644 --- a/src/config.js +++ b/src/config.js @@ -1,4 +1,4 @@ -import { PAYER_SK, OWNER_SK, DEVELOP_DOMAIN } from './developmode' +import { PAYER_SK, OWNER_SK, DEVELOP_DOMAIN, ADMIN_PASSWORD } from './developmode' import winston from 'winston' import fs from 'fs' @@ -17,7 +17,7 @@ const configDevelopDefaults = { batchDelayPeriod: 0.5, checkTransactionPeriod: 0.1, dbLocation: '/tmp/subdomain_registrar.db', - adminPassword: 'tester129', + adminPassword: ADMIN_PASSWORD, domainUri: 'file:///tmp/whatever', resolverUri: 'http://localhost:3000', zonefileSize: 40960, @@ -50,7 +50,7 @@ const configDefaults = { checkTransactionPeriod: 5, zonefileSize: 40960, dbLocation: 'subdomain_registrar.db', - adminPassword: 'NEEDS-A-PASSWORD', + adminPassword: null, domainUri: 'https://registrar.whatever.com', resolverUri: false, port: 3000, @@ -89,7 +89,9 @@ export function getConfig() { if (process.env.BSK_SUBDOMAIN_OWNER_KEY) { config.ownerKey = process.env.BSK_SUBDOMAIN_OWNER_KEY } - + if (process.env.ADMIN_PASSWORD) { + config.ownerKey = process.env.ADMIN_PASSWORD || configDevelopDefaults.ADMIN_PASSWORD + } if (process.env.BSK_SUBDOMAIN_PROMETHEUS_PORT) { config.prometheus = { start: true, port: parseInt(process.env.BSK_SUBDOMAIN_PROMETHEUS_PORT) } } diff --git a/src/developmode.js b/src/developmode.js index 8c5dd6a..a4d667b 100644 --- a/src/developmode.js +++ b/src/developmode.js @@ -6,6 +6,7 @@ import { StacksMocknet } from '@stacks/network' export const PAYER_SK = 'bb68eda988e768132bc6c7ca73a87fb9b0918e9a38d3618b74099be25f7cab7d01' export const OWNER_SK = '8f87d1ea26d03259371675ea3bd31231b67c5df0012c205c154764a124f5b8fe01' export const DEVELOP_DOMAIN = 'foo.id' +export const ADMIN_PASSWORD = 'tester129' function pExec(cmd) { return new Promise(