Skip to content

Commit

Permalink
Credentials: add sample
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyaksenov committed Jan 30, 2024
1 parent 53f36a3 commit 00722e9
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
credentials:
users:
admin:
password: 'T0p_Secret_P@$$w0rd'
roles: [ super ]
replicator:
password: 'topsecret'
roles: [ replication ]
storage:
password: 'secret'
roles: [ sharding ]
testuser:
password: '123456'
privileges:
- permissions: [ session ]
- permissions: [ execute ]
lua_eval: true
- permissions: [ read ]
spaces: [ writers, books ]
- permissions: [ read, write ]
spaces: [ writers ]


groups:
group001:
replicasets:
replicaset001:
instances:
instance001:
iproto:
listen:
- uri: '127.0.0.1:3301'

# Load sample data
app:
file: 'myapp.lua'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
instance001:
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function create_spaces()
box.schema.space.create('writers')
box.space.writers:format({
{ name = 'id', type = 'unsigned' },
{ name = 'name', type = 'string' }
})
box.space.writers:create_index('primary', { parts = { 'id' } })

box.schema.space.create('books')
box.space.books:format({
{ name = 'id', type = 'unsigned' },
{ name = 'title', type = 'string' },
{ name = 'author_id', foreign_key = { space = 'writers', field = 'id' } },
})
box.space.books:create_index('primary', { parts = { 'id' } })
end

function load_data()
box.space.writers:insert { 1, 'Leo Tolstoy' }
box.space.writers:insert { 2, 'Fyodor Dostoevsky' }
box.space.writers:insert { 3, 'Alexander Pushkin' }

box.space.books:insert { 1, 'War and Peace', 1 }
box.space.books:insert { 2, 'Crime and Punishment', 2 }
box.space.books:insert { 3, 'Eugene Onegin', 3 }
end

0 comments on commit 00722e9

Please sign in to comment.