File tree Expand file tree Collapse file tree 5 files changed +35
-3
lines changed Expand file tree Collapse file tree 5 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -78,3 +78,4 @@ android/keystores/debug.keystore
78
78
lib /
79
79
80
80
.env * .local
81
+ .env
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ module.exports = getConfig(
21
21
} ,
22
22
} ,
23
23
] ,
24
+ [ 'module:react-native-dotenv' ] ,
24
25
] ,
25
26
} ,
26
27
{ root, pkg }
Original file line number Diff line number Diff line change 32
32
"@react-native/eslint-config" : " 0.79.2" ,
33
33
"@react-native/metro-config" : " 0.79.2" ,
34
34
"@react-native/typescript-config" : " 0.79.2" ,
35
- "react-native-builder-bob" : " ^0.35.2"
35
+ "react-native-builder-bob" : " ^0.35.2" ,
36
+ "react-native-dotenv" : " ^3.4.11"
36
37
},
37
38
"op-sqlite" : {
38
39
"fts5" : true
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ const pouch = new PouchDB('mydb', {
21
21
adapter : 'react-native-sqlite' ,
22
22
revs_limit : 100 ,
23
23
} )
24
+ // @ts -ignore
25
+ globalThis . pouch = pouch
24
26
25
27
// async function run() {
26
28
// const db = open({ name: 'test' })
@@ -127,14 +129,22 @@ export default function App() {
127
129
}
128
130
}
129
131
const handleReplicate = async ( ) => {
130
- setResult ( 'Replicating from remote...' )
132
+ const remoteUrl = process . env . COUCHDB_URL
133
+ setResult ( `Replicating from remote...${ remoteUrl } ` )
134
+ if ( ! remoteUrl ) {
135
+ setResult (
136
+ 'CouchDB URL is not set. Please set COUCHDB_URL environment variable in `.env.local`.'
137
+ )
138
+ return
139
+ }
131
140
try {
132
141
const result = await pouch . replicate
133
- . from ( process . env . EXPO_PUBLIC_COUCHDB_URL , { live : false } )
142
+ . from ( remoteUrl , { live : false } )
134
143
. on ( 'error' , ( err : any ) => console . log ( 'error:' , err ) )
135
144
console . log ( 'ret:' , result )
136
145
setResult ( JSON . stringify ( result , null , 2 ) )
137
146
} catch ( e : any ) {
147
+ console . error ( e )
138
148
setResult ( e . name + ': ' + e . message )
139
149
}
140
150
}
Original file line number Diff line number Diff line change @@ -5880,6 +5880,13 @@ __metadata:
5880
5880
languageName: node
5881
5881
linkType: hard
5882
5882
5883
+ "dotenv@npm:^16.4.5":
5884
+ version: 16.5.0
5885
+ resolution: "dotenv@npm:16.5.0"
5886
+ checksum: 6543fe87b5ddf2d60dd42df6616eec99148a5fc150cb4530fef5bda655db5204a3afa0e6f25f7cd64b20657ace4d79c0ef974bec32fdb462cad18754191e7a90
5887
+ languageName: node
5888
+ linkType: hard
5889
+
5883
5890
"dunder-proto@npm:^1.0.0, dunder-proto@npm:^1.0.1":
5884
5891
version: 1.0.1
5885
5892
resolution: "dunder-proto@npm:1.0.1"
@@ -11362,6 +11369,7 @@ __metadata:
11362
11369
react: 19.0.0
11363
11370
react-native: 0.79.2
11364
11371
react-native-builder-bob: ^0.35.2
11372
+ react-native-dotenv: ^3.4.11
11365
11373
react-native-quick-crypto: ^0.7.8
11366
11374
languageName: unknown
11367
11375
linkType: soft
@@ -11917,6 +11925,17 @@ __metadata:
11917
11925
languageName: node
11918
11926
linkType: hard
11919
11927
11928
+ "react-native-dotenv@npm:^3.4.11":
11929
+ version: 3.4.11
11930
+ resolution: "react-native-dotenv@npm:3.4.11"
11931
+ dependencies:
11932
+ dotenv: ^16.4.5
11933
+ peerDependencies:
11934
+ "@babel/runtime": ^7.20.6
11935
+ checksum: 3ebac2c2ed79dd7e4920fd3fc2da9187413b7190231618e4858b46c47833677838b96d531afe7bd5c4b0a60454dba40cb8708722210df5d522e30aefbf41da05
11936
+ languageName: node
11937
+ linkType: hard
11938
+
11920
11939
"react-native-quick-base64@npm:^2.0.5":
11921
11940
version: 2.1.2
11922
11941
resolution: "react-native-quick-base64@npm:2.1.2"
You can’t perform that action at this time.
0 commit comments