-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
53f36a3
commit 00722e9
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
doc/code_snippets/snippets/config/instances.enabled/credentials/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
1 change: 1 addition & 0 deletions
1
doc/code_snippets/snippets/config/instances.enabled/credentials/instances.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
instance001: |
26 changes: 26 additions & 0 deletions
26
doc/code_snippets/snippets/config/instances.enabled/credentials/myapp.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |