Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding ADMIN_PASSWORD env var #50

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 6 additions & 4 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configDevelopDefaults.ADMIN_PASSWORD is not defined

Suggested change
config.ownerKey = process.env.ADMIN_PASSWORD || configDevelopDefaults.ADMIN_PASSWORD
config.ownerKey = process.env.ADMIN_PASSWORD || ADMIN_PASSWORD

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
if (process.env.BSK_SUBDOMAIN_PROMETHEUS_PORT) {
config.prometheus = { start: true, port: parseInt(process.env.BSK_SUBDOMAIN_PROMETHEUS_PORT) }
}
Expand Down
1 change: 1 addition & 0 deletions src/developmode.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down