Commit Graph

241 Commits

Author SHA1 Message Date
Ben Toogood
1b18730d54 Custom micro client 2020-05-14 11:25:19 +01:00
Ben Toogood
5764519f5b Refactor auth to load token outside wrappers 2020-05-14 11:06:22 +01:00
Ben Toogood
d39b723511 Auth Namespace Flag 2020-05-12 16:41:29 +01:00
Ben Toogood
efb64b7dbb Pass client to more of the runtime 2020-05-11 17:57:39 +01:00
Ben Toogood
f892b41299 Add runtime to service.Options() 2020-05-11 17:09:28 +01:00
Asim Aslam
b3915b6020
Add store to options (#1600) 2020-05-01 18:05:09 +01:00
Ben Toogood
669364985e JWT auth implementation 2020-04-29 09:21:17 +01:00
Asim Aslam
83ab47333f
rename Codec to Secrets (#1581) 2020-04-27 14:57:57 +01:00
268651df18
regenerate all proto based files (#1531)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-14 16:25:09 +03:00
bc71640fd9
broker: swap default broker from eats to http (#1524)
* broker: swap default broker from eats to http

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-11 03:46:54 +03:00
Asim Aslam
9a685b2df5
delete k8s registry (#1522) 2020-04-10 17:15:20 +01:00
1063b954de
dont display t.Log/t.Logf as errors in github actions (#1508)
* fix tests and github action annotations

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-04-09 14:05:46 +03:00
Asim Aslam
bf41d8d28e fix store table env var 2020-04-08 19:44:49 +01:00
Lars Lehtonen
900b2d24f9
config/secrets/box: fix dropped test error (#1494) 2020-04-06 23:09:42 +01:00
Jake Sanders
3324d140c0
Rename store Namespace / Prefix options to Database and Table (#1492)
* Rename Namespace to DB, Rename Prefix to table, Remove Suffix Option

* Rename options

* Rename options

* Add store_table option

* Table per service, not Database per service
2020-04-06 16:45:55 +01:00
Ben Toogood
dea2d7ab9f Fix go-micro auth wrapper init 2020-04-03 12:27:01 +01:00
Ben Toogood
d577c32563 Add back auth.PrivateKey 2020-04-01 17:17:40 +01:00
Ben Toogood
f7655b71ea Merge branch 'auth-interface-update' of https://github.com/micro/go-micro into auth-interface-update 2020-04-01 14:25:07 +01:00
Ben Toogood
8e4d9e1702 Further Refactoring 2020-04-01 14:25:00 +01:00
Asim Aslam
6c6c5359b1
Add options to config (#1450) 2020-03-31 17:13:21 +01:00
Ben Toogood
d659e435c6 Service => Service Auth 2020-03-31 12:44:34 +01:00
9e6db79860
regenerate all proto (#1440)
* regenerate all proto

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* regenerate from proto

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* regenerate from proto

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-30 21:58:32 +01:00
ben-toogood
329bd09f93
Fix Auth Init bug (#1424)
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-26 18:09:51 +00:00
Jake Sanders
397a8638f4
Cockroach Store bugfix (#1401) 2020-03-24 17:16:38 +00:00
ben-toogood
fd664f4392
Auth load rules (#1397)
* WithRoles variadic args

* Load Rules

* Timer => Ticker

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-24 13:48:37 +00:00
ben-toogood
e0e77f3983
Updated auth interface (#1384)
* Updated  auth interface

* Add Rule

* Remove Rule

* Return token from Renew

* Renew => Refresh

* Implement Tokens & Default Auth Implementation

* Change default auth to noop

* Change default auth to noop

* Move token.Token to auth.Token

* Remove Token from Account

* Auth service implementation

* Decode JWT locally

* Cookie for secret

* Move string to bottom of interface definition

* Depricate auth_exclude

* Update auth wrappers

* Update go.sum

Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-23 16:19:30 +00:00
cbb958def5
config: fix panic on multiple Close() (#1374)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-19 12:54:59 +03:00
60993e6275
config/source/service: base64 fix (#1345)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-13 21:44:55 +00:00
Asim Aslam
d8cfa7a295
add config to cmd (#1337)
* add config to cmd

* fix build
2020-03-12 18:47:40 +00:00
ben-toogood
47f1203e97
Add Config to service options (#1336)
Co-authored-by: Ben Toogood <ben@micro.mu>
Co-authored-by: Asim Aslam <asim@aslam.me>
2020-03-12 18:13:03 +00:00
Asim Aslam
be9c6141f5
delete options (#1333) 2020-03-12 09:05:09 +00:00
Asim Aslam
f55493993c
set namespace rather than key (#1331) 2020-03-11 22:31:24 +00:00
7b385bf163
minimize allocations in logger and tunnel code (#1323)
* logs alloc

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix allocs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix allocs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* tunnel allocs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* try to fix tunnel

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* cache cipher for send

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* more logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-03-11 17:55:39 +00:00
Jake Sanders
4125ae8d53
Add secrets interface to config/secrets (#1325)
* Interface for secrets

* Add secretbox secrets implementation

* Start working on box

* typo

* Add asymmetric encryption implementation

* go mod tidy

* Fix review comments

Co-authored-by: Asim Aslam <asim@aslam.me>
2020-03-10 22:52:06 +00:00
ben-toogood
9a7a65f05e
Auth Provider (#1309)
* auth provider mock interface

* Auth Provider Options

* Implement API Server Auth Package

* Add weh utils

* Add Login URL

* Auth Provider Options

* Add auth provider scope and setting token in cookie

* Remove auth_login_url flag

Co-authored-by: Asim Aslam <asim@aslam.me>
Co-authored-by: Ben Toogood <ben@micro.mu>
2020-03-07 11:06:57 +00:00
Lars Lehtonen
80f2bfd5d0
config: remove unused sep variable (#1262) 2020-02-26 08:25:33 +00:00
Asim Aslam
6aaaf54275
add MICRO_AUTH_TOKEN, parse token in wrapper, preload config and othe… (#1261)
* add MICRO_AUTH_TOKEN, parse token in wrapper, preload config and other things

* fix wrapper panic
2020-02-25 22:15:44 +00:00
Di Wu
603d37b135
Set option and cli args to the service profile (#1259) 2020-02-25 16:42:42 +00:00
ben-toogood
ffdf986aac
Refactor auth: add token and store implementations (#1230)
* Refactor auth: add token and memory implementations

* Fix typo

* Remove memory auth (implemented already by the store implementation), revert default to noop

* Add grpc header

* Global Config

* config/global => util/config

* Rename package to remove confict

* Tweak

* Improve Error Handling
2020-02-24 15:07:27 +00:00
117f56ebf7
prune util/log and user logger (#1237)
* prune util/log and user logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* plaintext logger

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* add newline

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-23 13:45:20 +00:00
ben-toogood
e080ecb43a
Auth Improvements (#1195)
* Exclude Stats & Trace from Auth

* Update Excluded Endpoints Format

* Tweak Implementation
2020-02-13 14:07:14 +00:00
ben-toogood
4401c12e6c Auth Wrapper (#1174)
* Auth Wrapper

* Tweak cmd flag

* auth_excludes => auth_exclude

* Make Auth.Excludes variadic

* Use metadata.Get (passes through http and http2 it will go through various case formats)

* fix auth wrapper auth.Auth interface initialisation

Co-authored-by: Asim Aslam <asim@aslam.me>
2020-02-10 08:26:28 +00:00
Lars Lehtonen
ca1d0b94c3
config/cmd: remove 8 unused variables (#1175) 2020-02-08 11:19:10 +00:00
67acd9288b
config/source/cli: fix tests (#1179)
* config/source/cli: fix tests
* skip mdns test in travis

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-08 02:45:32 +03:00
0bf6c9fc08
config/source/cli: fix default flag value loading (#1178)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-02-08 02:14:34 +03:00
ben-toogood
bf747a86f4
Runtime (#1160)
* Add String to Runtime interface

* Setup Dynamic Runtime Configuration
2020-02-05 13:59:35 +00:00
ben-toogood
d621548120
Auth (#1147)
Implement the Auth interface, with JWT and service implementations.

* Update Auth Interface

* Define Auth Service Implementation

* Support Service Auth

* Add Auth Service Proto

* Remove erronious files

* Implement Auth Service Package

* Update Auth Interface

* Update Auth Interface. Add Validate, remove Add/Remove roles

* Make Revoke interface more explicit

* Refactor serializing and deserializing service accounts

* Fix srv name & update interface to be more explicit

* Require jwt public key for auth

* Rename Variables (Resource.ID => Resource.Name & ServiceAccount => Account)

* Implement JWT Auth Package

* Remove parent, add ID

* Update auth imports to v2. Add String() to auth interface
2020-02-03 08:16:02 +00:00
Asim Aslam
0be22c98c6 add tracing 2020-01-30 23:24:46 +00:00
f23638c036 fix import paths for v2 release
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-01-30 14:44:40 +03:00
Asim Aslam
a291af59c4
Merge pull request #1142 from micro/tracing
Fix null tracer bug
2020-01-30 07:55:58 +00:00
Ben Toogood
d9f12731e1 Fix null tracer bug 2020-01-30 07:53:31 +00:00
Asim Aslam
4a838a8210 Merge branch 'master' of ssh://github.com/micro/go-micro 2020-01-29 23:14:16 +00:00
Asim Aslam
5969cc358e nats-e => eats 2020-01-29 23:14:05 +00:00
Asim Aslam
9f1a7e1139
Merge pull request #1127 from Allenxuxu/master
handle Loader.Load  return value error
2020-01-29 22:44:29 +00:00
Asim Aslam
49b86c56e3 go fmt 2020-01-29 22:40:43 +00:00
Asim Aslam
de3c3b27b2
Merge pull request #1140 from micro/tracing
Tracing by Ben Toogood
2020-01-29 22:28:49 +00:00
Micro
62c067adcd Refactor debug/trace ready for Jaeger 2020-01-29 15:45:11 +00:00
Lars Lehtonen
895aa896bc
config/reader/json: remove unused newValue() 2020-01-28 11:38:55 -08:00
e6a34bcbe7 update micro/cli to urfave/cli/v2 and fix go-micro
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2020-01-25 15:57:08 +03:00
Asim Aslam
2b1844971c go fmt 2020-01-24 21:31:57 +00:00
Asim Aslam
1c19678d04 Update proto Service => Config 2020-01-23 11:37:54 +00:00
Shu xian
8e1ff80b9e
Merge pull request #1 from micro/master
merge
2020-01-20 20:08:21 +08:00
shu xian
94bb0f4c08 watch supports path 2020-01-20 18:31:18 +08:00
Allenxuxu
dbe209ebe4 Merge branch 'master' of https://github.com/micro/go-micro 2020-01-20 08:37:34 +08:00
Asim Aslam
3f3c1919f4 strip certain plugins 2020-01-19 17:56:59 +00:00
Asim Aslam
e75b99f89c go fmt 2020-01-19 13:32:24 +00:00
Allenxuxu
ee7304a795 NewConfig return value error 2020-01-19 16:42:05 +08:00
Allenxuxu
a82fd19209 handle Loader.Load return value error 2020-01-19 16:31:02 +08:00
Asim Aslam
1983d607f3 set nats-e 2020-01-19 01:47:30 +00:00
Asim Aslam
11b104677a Shift embedded nats to the default 2020-01-19 00:55:01 +00:00
shu xian
8d6f82707a update to standard name convention 2020-01-18 23:16:23 +08:00
shu xian
9ea4919b9b rename mucp source directory to service 2020-01-17 23:53:33 +08:00
shu xian
ad28b72dd3 rename mucpSource to service 2020-01-17 23:27:41 +08:00
shu xian
a03791c581 set DefaultClient 2020-01-17 21:32:00 +08:00
shu xian
071ab7aede add mucp for config/source 2020-01-17 00:10:15 +08:00
Asim Aslam
1d311ab457
Embedded NATS Broker (#1110)
* if the address is produced by a default route don't hash it

* embedded nats

* fix url parsing

* don't override help

* add ready flag
2020-01-14 13:23:16 +00:00
Shu xian
fa5b3ee9d9 config/reader.Values add Set for specific path merge (#1099)
* add Set for specific path merge

* add Set

* add Del
2020-01-11 20:50:09 +00:00
Asim Aslam
f50a50eeb3 go fmt 2020-01-10 21:54:36 +00:00
Asim Aslam
6ca298c61d set default store, fix store options bug, add String method 2020-01-10 19:13:55 +00:00
Asim Aslam
048065fe96
support ability to set store, address and namespace via flags and env vars (#1092) 2020-01-08 12:11:31 +00:00
Asim Aslam
be6e8a7c78
add store to defaults (#1086) 2020-01-06 17:44:32 +00:00
Asim Aslam
f40d4578d5 go fmt 2019-12-30 17:29:45 +00:00
Asim Aslam
c145f355dd
Moving to gRPC by default (#1069)
* Step 1

* Fix the test panics
2019-12-29 21:07:55 +00:00
Asim Aslam
61cde4a9f4
Kubernetes Registry (#1064)
* add teh k8s registry

* add k8s reg config/cmd

* go mod update
2019-12-27 20:08:46 +00:00
Asim Aslam
81e20160f5 reorder 2019-12-23 08:49:53 +00:00
Asim Aslam
ef95b28e3d add Write method to config source 2019-12-23 08:42:57 +00:00
Asim Aslam
ff69d46c98 strip some cruft from config/cmd 2019-12-10 18:12:29 +00:00
Allenxuxu
b55b7d6b20 replace map with list 2019-12-05 19:29:48 +08:00
a1eaf9cc20 linting fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2019-12-04 00:22:02 +03:00
Till Knuesting
5ae3e179b9 preallocated slices (#934) 2019-11-11 00:03:51 +00:00
Asim Aslam
ce080d76c6
add debug/profile package (#920)
* add debug/profile package

* set service+version for profile
2019-11-06 19:36:04 +00:00
Till Knuesting
f67c5e779f preallocated slices (#917) 2019-11-05 17:43:12 +00:00
Milos Gajdos
6f7702a093 [WIP] K8s update and runtime package changes (#895)
* First commit: outline of K8s runtime package

* Added poller. Added auto-updater into default runtime

* Added build and updated Poller interface

* Added comments and NewRuntime that accepts Options

* DefaultPoller; Runtime options

* First commit to add Kubernetes cruft

* Add comments

* Add micro- prefix to K8s runtime service names

* Get rid of import cycles. Move K8s runtime into main runtime package

* Major refactoring: Poller replaced by Notifier

POller has been replaced by Notifier which returns a channel of events
that can be consumed and acted upon.

* Added runtime configuration options

* K8s runtime is now Kubernetes runtime in dedicated pkg. Naming kung-fu.

* Fix typo in command.

* Fixed typo

* Dont Delete service when runtime stops.

runtime.Stop stops services; no need to double-stop

* Track runtime services

* Parse Unix timestamps properly

* Added deployments into K8s client. Debug logging
2019-11-02 13:25:10 +00:00
tegk
f88518d994 used gofmt with -s flag on whole project 2019-11-01 15:07:53 +00:00
Asim Aslam
d4832e8f34
Remove consul registry (#818) 2019-10-23 15:53:28 +01:00
Asim Aslam
b80654bf7e Add broker service to config/cmd 2019-10-03 16:22:26 +01:00
Asim Aslam
af5d7a3420 Move the remaining consul cruft to go-plugins 2019-10-03 11:22:35 +01:00
Asim Aslam
8d2b12258f Remove gossip registry 2019-10-03 09:29:48 +01:00
Milos Gajdos
25148af44c First commit to add etcd registry support 2019-10-02 18:56:53 +01:00
Milos Gajdos
87a5e85062 Add 1.13 support. Fix tests to enable 1.13 support 2019-09-27 17:14:24 +01:00
Asim Aslam
7fe64192a7 Add flag for registry service client 2019-09-25 11:09:19 +01:00
Asim Aslam
fa0d020556 Set register ttl and interval by default 2019-09-23 17:59:34 +01:00
Yumin Wu
5b991cd2c2 Update config source README file 2019-09-04 15:49:58 +08:00
Yumin Wu
ff81e4b246 Load consul source 2019-08-30 16:20:58 +08:00
Milos Gajdos
86f0c06fac
Removed filewatch counter test. 2019-08-21 11:26:41 +01:00
Milos Gajdos
4ea27517b5
Source watcher ErrStoppedWatcher and fixed test 2019-08-20 22:32:47 +01:00
Shu Xian
2413cbcd80 fix file watcher event bug on Linux
the watcher can not normally get events of file changes on linux. it just can get the first two changes.
2019-08-19 15:28:24 +08:00
刘小乐
cd2ac648ff
Fix read yaml config from memory
package main

import (
	"fmt"

	"github.com/micro/go-micro/config"
	"github.com/micro/go-micro/config/source/memory"
)

var configData = []byte(`
---
a: 1234
`)

func main() {
	memorySource := memory.NewSource(
		memory.WithYAML(configData),
	)
	// Create new config
	conf := config.NewConfig()

	// Load file source
	conf.Load(memorySource)

	fmt.Println(string(conf.Bytes()))
}
2019-08-11 18:05:35 +08:00
刘小乐
7bd6d1b549
no more WithData method, instead of WithJSON 2019-08-09 12:45:59 +08:00
Asim Aslam
cb1c1afc84 add quic to defaults 2019-08-08 00:19:30 +01:00
Asim Aslam
2b5bf1154a rename config tests 2019-07-28 19:52:01 +01:00
Asim Aslam
64ec0633a3 Fix breaks and go fmt 2019-07-10 07:47:17 +01:00
Asim Aslam
0bf54c122f move transport back 2019-07-09 18:41:26 +01:00
Asim Aslam
777a203f96 gofmt 2019-07-07 12:33:54 +01:00
Asim Aslam
d2d6841f02 Move transport to network/transport 2019-07-07 10:37:34 +01:00
Asim Aslam
00ba1655ca remove some readmes 2019-07-04 11:15:54 +01:00
Asim Aslam
ac098e4d78 add router selector and network defaults 2019-06-26 16:12:57 +01:00
magodo
a8dbca756c rename stuff per feedback 2019-06-25 22:41:31 +08:00
magodo
8e4fd16aff Add consul-specific option for config (as registry) 2019-06-25 18:31:32 +08:00
magodo
6ef838c9aa Merge branch 'master' of https://github.com/micro/go-micro into config_source_consul_support_array 2019-06-22 07:14:15 +08:00
Asim Aslam
1b4005e9a5 Go fmt everything 2019-06-21 17:20:41 +01:00
Asim Aslam
6db720b197 Merge branch 'master' of ssh://github.com/micro/go-micro 2019-06-21 15:14:08 +01:00
Asim Aslam
ca5acba0c6 Move selector to client/selector 2019-06-21 15:13:54 +01:00
Asim Aslam
b4acb9bb58
Merge pull request #538 from magodo/consul_path_prefix_leading_slash
config consul source supports slash as prefix
2019-06-21 14:23:53 +01:00
Asim Aslam
c350e19552 Move cmd => config/cmd 2019-06-21 13:36:11 +01:00
magodo
3c82b2e9e8 Merge branch 'consul_path_prefix_leading_slash' into dev 2019-06-21 16:53:21 +08:00
magodo
7acd249147 config consul source supports slash as prefix
`config.NewConfig()` with consul source will both read from consul
and watch consul for changes. Hence, the `prefix` is used in these
2 cases:

- read case: it is used to strip path based on the `KVPair` returned
from consul `kv.List()` method
- watch case: it is used as the `key` of watch query (`keyprefix` type)

So for *watch case*, the `key` is leagal to be `/` for watching change
on root. While for *read case*, because `KVPair.Key` is always stripped
off the leading slash, so if user specified some `prefix` with leading
slash, we should strip it also.

An extream case would be: user want's to read & watch node in root dir.
One would specify `prefix` as `/`, and it should work then.
2019-06-21 16:35:48 +08:00
magodo
1983b4ae92 variable rename to abstract encoder 2019-06-21 15:30:45 +08:00
magodo
92b998c3ab consul config source support 1st-level array
Check whetehr the 1st level encoded json is array or not, to
support 1st level array in consul config.

During debug, i suspected the incapability of arrray is caused by
json reader, so i added test for array. I think it makes no harm
to also check that in.
2019-06-21 00:25:39 +08:00
magodo
606b1ff7cf prefix in consul api starts with no leading slash
When `consul.StripPrefix(true)` is set, current impl. will pass the
specified prefix (or default prefix) when calling consul api.

However, `prefix` in consul api starts with no leading slash, so
the default prefix (`/micro/config`) doesn't actually work.

I avoid code changes (esp. the one in `util.go`) to eliminate
impact on users who already notice it.
2019-06-19 14:42:09 +08:00
Asim Aslam
97967cbe14 move options under config 2019-06-12 12:45:42 +01:00
Asim Aslam
aec1ca6635 remove etcd source 2019-06-11 09:53:06 +01:00
outshow
90a9df9b8c 1. use github.com/coreos instead of go.etcd.io in etcd related import path; 2. add dialtimeout to etcd client 2019-06-11 16:18:37 +08:00
Asim Aslam
a2fbf19341 Move sync deps, change uuid to google and update go.mod 2019-06-07 13:53:42 +01:00
Asim Aslam
2aba26d4d1 change logger 2019-05-31 16:03:50 +01:00
Asim Aslam
f9f893fa85 update source 2019-05-31 15:59:21 +01:00
Asim Aslam
30627c32c9 the garbage commit of go.mod vault deps 2019-05-31 15:24:15 +01:00
Asim Aslam
1374c5b14a update syntax 2019-05-31 13:45:28 +01:00
Asim Aslam
082d0b9f05 add memory config source options for json/yaml 2019-05-31 13:44:28 +01:00
Asim Aslam
ef9c223ac8 add vault/etcd 2019-05-31 12:38:49 +01:00
Asim Aslam
5e6491b7b0 add config 2019-05-30 23:11:13 +01:00