Skip to content

arvenil/osin-dynamodb

 
 

Repository files navigation

osin-dynamodb

Circle CI GoDoc Coverage Status Report Card

This package implements the storage for OSIN with Amazon DynamoDB using aws-sdk-go.

Installation

Install library with go get github.com/uniplaces/osin-dynamodb

or if you use glide with glide get github.com/uniplaces/osin-dynamodb

Usage

import (
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/dynamodb"
	"github.com/uniplaces/osin-dynamodb"
	"github.com/RangelReale/osin"
	"os"
)

func main() {
    // This is configuration for local DynamoDB instance used in tests,
    // for details how to configure your real AWS DynamoDB connection check DynamoDB documentation
	os.Clearenv()
	os.Setenv("AWS_ACCESS_KEY_ID", "a")
	os.Setenv("AWS_SECRET_ACCESS_KEY", "b")

	svc := dynamodb.New(session.New(&aws.Config{
		Endpoint: aws.String("http://localhost:4567"),
		Region:   aws.String("us-west-1"),
	}))
	
	// You can use CreateStorageConfig helper to create configuration or you can create it by yourself
	storageConfig := osindynamodb.CreateStorageConfig("oauth_table_prefix_")
	
	// Initialization
    store := osindynamodb.New(svc, storageConfig)
    server := osin.NewServer(osin.NewServerConfig(), store)

    // For further details how to use osin server check osin documentation
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%