Skip to content

Commit

Permalink
Update all hostie -> service (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
huan committed Jan 23, 2021
1 parent a3e6b3f commit bed8962
Show file tree
Hide file tree
Showing 12 changed files with 213 additions and 171 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Pack Testing
run: ./scripts/npm-pack-testing.sh
env:
WECHATY_PUPPET_HOSTIE_TOKEN: ${{ secrets.WECHATY_PUPPET_HOSTIE_TOKEN }}
WECHATY_PUPPET_SERVICE_TOKEN: ${{ secrets.WECHATY_PUPPET_SERVICE_TOKEN }}

publish:
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/v'))
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,23 @@
[![NPM Version](https://badge.fury.io/js/wechaty-puppet-service.svg)](https://www.npmjs.com/package/wechaty-puppet-service)
[![NPM](https://github.com/Chatie/grpc/workflows/NPM/badge.svg)](https://github.com/wechaty/wechaty-puppet-service/actions?query=workflow%3ANPM)

![Hostie](https://wechaty.github.io/wechaty-puppet-service/images/hostie.png)
![Wechaty Hostie](https://wechaty.github.io/wechaty-puppet-service/images/hostie.png)

Hostie Puppet for Wechaty
Wechaty Puppet Service is gRPC for Wechaty Puppet Provider.

For example, we can cloudify the Wechaty Puppet Provider wechaty-puppet-padlocal
to a Wechaty Puppet Service by running our Wechaty Puppet Service Token Gateway.

If you want to learn more about what is Wechaty Puppet and Wechaty Puppet Service,
we have a blog post to explain them in details at
<https://wechaty.js.org/2021/01/14/wechaty-puppet-service/>

[![Powered by Wechaty](https://img.shields.io/badge/Powered%20By-Wechaty-brightgreen.svg)](https://github.com/Wechaty/wechaty)

## Features

1. Consume hostie service
1. Provide hostie service
1. Consume Wechaty Puppet Service
1. Provide Wechaty Puppet Service

## Usage

Expand All @@ -22,7 +29,7 @@ import { Wechaty } from 'wechaty'
const wechaty = new Wechaty({
puppet: 'wechaty-puppet-service',
puppetOptions: {
token: 'hostie_token'
token: '__WECHATY_PUPPET_SERVCIE_TOKEN__'
}
})

Expand All @@ -31,12 +38,12 @@ wechaty.start()

## Environment Variables

### 1 `WECHATY_PUPPET_HOSTIE_TOKEN`
### 1 `WECHATY_PUPPET_SERVICE_TOKEN`

The token set to this environment variable will become the default value of `puppetOptions.token`

```sh
WECHATY_PUPPET_HOSTIE_TOKEN=hostie_token node bot.js
WECHATY_PUPPET_SERVICE_TOKEN=__WECHATY_PUPPET_SERVCIE_TOKEN__ node bot.js
```

## History
Expand Down
4 changes: 2 additions & 2 deletions examples/ding-dong-bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import {
FileBox,
} from 'wechaty-puppet'

import { PuppetHostie } from '../src/'
import { PuppetService } from '../src/'

/**
*
* 1. Declare your Bot!
*
*/
const puppet = new PuppetHostie()
const puppet = new PuppetService()

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import { test } from 'tstest'

import { PuppetHostie } from './puppet-hostie'
import { PuppetService } from './puppet-service'

test('version()', async (t) => {
const puppet = new PuppetHostie({
const puppet = new PuppetService({
token: 'test',
})
t.ok(puppet.version())
Expand All @@ -15,15 +15,15 @@ test('version()', async (t) => {
* Huan(202003):
* need to setup a test server to provide test token for Puppet Service
*/
test.skip('PuppetHostie restart without problem', async (t) => {
const puppet = new PuppetHostie()
test.skip('PuppetService restart without problem', async (t) => {
const puppet = new PuppetService()
try {
for (let i = 0; i < 3; i++) {
await puppet.start()
await puppet.stop()
t.pass('start/stop-ed at #' + i)
}
t.pass('PuppetHostie() start/restart successed.')
t.pass('PuppetService() start/restart successed.')
} catch (e) {
t.fail(e)
}
Expand Down
Loading

0 comments on commit bed8962

Please sign in to comment.