Chris Lu
5 years ago
60 changed files with 268 additions and 247 deletions
-
2go.mod
-
6unmaintained/repeated_vacuum/repeated_vacuum.go
-
2unmaintained/volume_tailer/volume_tailer.go
-
4weed/command/backup.go
-
3weed/command/benchmark.go
-
7weed/command/filer.go
-
6weed/command/filer_copy.go
-
17weed/command/filer_replication.go
-
12weed/command/master.go
-
3weed/command/mount_std.go
-
7weed/command/s3.go
-
8weed/command/scaffold.go
-
3weed/command/shell.go
-
6weed/command/upload.go
-
2weed/command/volume.go
-
3weed/command/webdav.go
-
6weed/filer2/cassandra/cassandra_store.go
-
3weed/filer2/configuration.go
-
6weed/filer2/etcd/etcd_store.go
-
20weed/filer2/filechunks_test.go
-
6weed/filer2/filerstore.go
-
4weed/filer2/leveldb/leveldb_store.go
-
4weed/filer2/leveldb2/leveldb2_store.go
-
18weed/filer2/mysql/mysql_store.go
-
18weed/filer2/postgres/postgres_store.go
-
14weed/filer2/redis/redis_cluster_store.go
-
8weed/filer2/redis/redis_store.go
-
4weed/filer2/tikv/tikv_store.go
-
2weed/filesys/dirty_page_interval.go
-
14weed/notification/aws_sqs/aws_sqs_pub.go
-
9weed/notification/configuration.go
-
11weed/notification/gocdk_pub_sub/gocdk_pub_sub.go
-
12weed/notification/google_pub_sub/google_pub_sub.go
-
10weed/notification/kafka/kafka_queue.go
-
2weed/notification/log/log_queue.go
-
4weed/replication/replicator.go
-
10weed/replication/sink/azuresink/azure_sink.go
-
10weed/replication/sink/b2sink/b2_sink.go
-
19weed/replication/sink/filersink/filer_sink.go
-
8weed/replication/sink/gcssink/gcs_sink.go
-
2weed/replication/sink/replication_sink.go
-
18weed/replication/sink/s3sink/s3_sink.go
-
15weed/replication/source/filer_source.go
-
14weed/replication/sub/notification_aws_sqs.go
-
4weed/replication/sub/notification_gocdk_pub_sub.go
-
12weed/replication/sub/notification_google_pub_sub.go
-
14weed/replication/sub/notification_kafka.go
-
2weed/replication/sub/notifications.go
-
4weed/security/tls.go
-
8weed/server/filer_server.go
-
16weed/server/master_server.go
-
9weed/server/volume_grpc_client_to_master.go
-
7weed/server/volume_server.go
-
4weed/server/webdav_server.go
-
6weed/shell/command_fs_meta_notify.go
-
14weed/storage/backend/backend.go
-
14weed/storage/backend/s3_backend/s3_backend.go
-
13weed/util/config.go
-
24weed/util/config_test.go
@ -0,0 +1,24 @@ |
|||||
|
package util |
||||
|
|
||||
|
import ( |
||||
|
"os" |
||||
|
"testing" |
||||
|
|
||||
|
"github.com/stretchr/testify/assert" |
||||
|
) |
||||
|
|
||||
|
func TestAllKeysWithEnv(t *testing.T) { |
||||
|
|
||||
|
v := GetViper() |
||||
|
v.BindEnv("id") |
||||
|
v.BindEnv("foo", "foo") |
||||
|
|
||||
|
// bind and define environment variables (including a nested one)
|
||||
|
os.Setenv("WEED_ID", "13") |
||||
|
os.Setenv("WEED_FOO_BAR", "baz") |
||||
|
|
||||
|
sub := v.Sub("foo") |
||||
|
|
||||
|
assert.Equal(t, "13", v.GetString("id")) |
||||
|
assert.Equal(t, "baz", sub.GetString("bar")) |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue